I'm working with the Alternate Active mode with PSoC3. In this mode, the CPU is in a halt state and it's supposed that you can enable/disable the peripherals you want to use. For this purpose, you've to use a specific registers called Standby Registers. All this registers are allocated in the cydevice.h document and they have the typology like "CYDEV_PM_STBY_CFGx".

The problem is that I haven't found the place where all this registers are explained and, therefore, i am not able to know which register controls which peripheral. There isn't in the TRM and other programming manuals that I know. Does someone know where are this registers explained?

Hello there. Have you checcked the Register TRM yet? If you want to find out which register is dedicated for what purpose, it is the register TRM that you might want to look at, not the architecture TRM. You can find the doc here, http://www.cypress.com/?rID=37833

Thank's U2. You're right. I had the TRM of the Architecure not the Regirter TRM. About it, I have 2 doubts:

1. I want to continue using the ports in the Alternate mode. For that purpose, in the Register TRM appears the register PM_STBY_CFG13, whose bit 3 is used to enable ports. The problem is that in my cydevice.h doesn't appear this register and in the Workspace either. I am using the CY8C3866AXI040-ES2. How can then control the ports?

2. The steps would be: change the corresponding register in order to enable the peripheral that I want, put the device into Alternate mode and then, reset the register introducing zeros when I don't want to use the peripheral anymore. Am I right?

Yes step2 is precisely the thing that oyu need to do for alternate active mode. But I am afraid, at this point of time we dont make the register TRM for ES2 available. ES2 is a not a production quality silicon. Why dont you upgrade to ES3? If you already don't know, we have an exchange program wherein you get a ES3 slicon as a replacement for your ES2 silicon.

Hello, I pulled the older version of the register TRM and figured that the register PM_STBY_CFG13 exists. As such, there is not much diffference as far as registers are concerned. The register PM_STBY_CFG13 has an address of 0x43AD. However as you have pointed out the definition does not seem to exist for a ES2 device in PSoC Creator. You can at any point of time write to the register using the API,

I've not updated yet to ES3 because I neet to upgrade more than 10 kits and I must wait at least 1month due to money issues...Anyway, do you mean that all the STBY registers are not supported in ES2 version? Or just some of them?

Moreover, in case that I were using ES3 and I would like to use Alternate mode with the Ports Active (bit 3 of the PM_STBY_CFG13 register). Hence, does the instruccion would be: CYREG_PM_STBY_CFG13 = 0x08u?

I understand your instruction CY_SET_REG8(0x43AD,CY_GET_REG8(0x43AD)|0x80). I didn't know how to set up a register... But I've found a problem. I thought that when the CPU was in Alternate mode, you must enable/disable the peripherals that you want. But, I've tried the following code and it seems that is not required. I light up a led, then I put the device en Altarnate mode and after that, I try to put off the led. But the led stills on... Is not supposed that, whether the CPU is off, there is anything that gives current to the led?

I would guess that some registers in ES2 were masked and not all the registers.

As fas as your code is concerned, what happens is, when you call the CyPmAltAct(PM_ALT_ACT_TIME_NONE,PM_ALT_ACT_SRC_NONE); API, the CPU is disabled. So the code execution is stopped. That is why your Pin is high and does not go low; since that piece of code is not executed. You can have the CPU running by keeping it enabled in alternate active mode.

Hi Trortis. You are right in saying that the CPU is disabled during alternate active mode. When you execute the statement Pin_1_Write(1u);

the data is latched in to Pin Data Register and this register holds the Pin and as long as the device has power the Pin state would not change unless CPU or DMA changes the Pin Data Register value.

Your statement,

The CPU continues keeping the led on...I thought in this modes the CPU was unable to continue working.

is invalid.

Yes, in alternate active mode, you can keep specific portions of your chip like Opamp to be on and turn off other unused peripherals. So how do you know that the device is not entering alternate active mode.

You can enable or disable the peripherals and CPU during Standby using the 13 Configuration registers.

Clearing bit1 of PM_STBY_CFG0 before calling the Alternate Active API will cause the CPU to halt when in alternate active (standby) mode.

Similarly, you can decide the fate of other peripherals. If you want the Opamp to be operating when the device is in Alternate Active mode, then explicitly set the bits 0,1,2 or 3 of PM_STBY_CFG4 depending upon which opamp you want to enable.

If you are not sure of which peripherals are enabled by default, you can run the device in debug mode and look into the 13 configuration registers in the watch window.

Maybe, my doubt was enough clear. The point is that I don't understend the utility of the Standby Registers whether you can enable/disable the peripherals with its corresponding API. For example this code:

OpAmp_Start();

CyPmAltAct(PM_ALT_ACT_TIME_NONE,PM_ALT_ACT_SRC_NONE);

Pin_1_Write(1u);

I know the device is in Alternate mode since the LED Attached to Pin_1 is off. But with the API OpAmp_Start(), I've achieved that the OpAmp stills working despite the CPU is off, without using the Standby Register associated. Why do I need the STBY Registers whether I can enable/disable peripherals before enter to Alternate mode with its Start() and Stop() APIs?

First thing that one has to be remember is that the CFG registers have an effect only during alternate active mode and not during active mode. The CFG registers take effect when the device jumps to alternate active mode. When a peripheral is disabled using alternate active mode, the power to the peripheral shuts down, but the other register configuration and hence the component configuration is unaltered. As a result when you move from alternate active to active mode you come back to the state which you were in before entering alternate active mode. Also note that typically when you enter sleep mode you have to stop all the peripherals to reduce current consumption using the STOP APIs. If your design has more number of components, your code will have to stop and prepare each component for sleep. However, if you enter alternate active mode, all you need to do is write in to the CFG registers only once. A single API call will put the device to alternate active and based on the CFG register settings peripherals are disbaled and poewr consumption goes down.

Thank's U2, finally I understand. But then, the CFG registers are used also for disable, aren't they? I say this because in the Register TRM indicates enable not disable...I will test the Alternate mode disableing an OpAmp. And after the device wakes up and returns to Active mode, I will check if the OpAmp stills working. This code would be:

Yes that is correct, the opamp will be disabled during alternate active and it will continue functioning in active mode. But if you have to swithc to active mode, you need to configure a suitable wakeup source.