This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hi everyone,
I’m working on ZStack 2.3.0, SampleApp and CC2530. I would like to know where do you modify the code for GPIO on my CC2530? I tried to change my I/Os as output low in hal_board_cfg.h and HAL_BOARD_INIT() function, but I do not see any changes on the consumption of my battery board. I cannot reduce to some uA as said in the CC2530 specification.
I actually consume 105 uA with the SOCBBoard.
This is the code I wrote :
P0SEL &= ~0xFF;
P1SEL &= ~0x0F;
P2SEL &= ~0x1F;
P0DIR |= 0xFF;
P1DIR |= 0xF0;
P2DIR |= 0x1F;
P0 &= ~0xFF;
P0 &= ~0xF0;
P0 &= ~0x1F;
Is that correct ?
Thank you !
Setting PxSEL = 0 (=use I/O pin for GPIO, manually controlled instead of peripheral device) and PxDIR = 1 (=I/O pin direction is output) for every I/O pin and then set Px = 0 to set pins as output low (where x = port number, 0,1 or 2) is the correct way, yes.
Since you set P1SEL &= ~0x0F, it indicates that you want to leave the pins P1.0, P1.2, P1.3, P1.4 unchanged. I assume these are already configured to be controlled by the USART1 peripheral, for use as UART or SPI interface.
It seems that you have a typo in your code, all the three last lines refers to P0, instead of P1 and P2. Maybe you've fixed it already.
The current consumption you can measure will not only depend on the state of your I/O pins and what they are connected to (even though it's important too), but also the amount of peripherals inside the system-on-chip is in use (e.g. timers, adc, usarts, dma etc), which power mode the CPU is in (if it's running or not), if the high-speed crystal oscillator (32 MHz XOSC) is enabled or not, if you are running the chip with a debugger attached (will increase power consumption in PM2/PM3) etc.
When you measured 105 µA -- which power mode was the chip in?
Indeed I had typo in my code, you're right, thanks :
P0 &= ~0xFF;
P1 &= ~0xF0;
P2 &= ~0x1F;
I'm quite interested in the answer. I have actually the same problem. No way to have an optimized current consumption with any example delivered by TI (CC2530 Em + Z-Stack 2.3.0). A little strange...
To get a low power consumption, it is important that I/O defined as outputs do not have heavy loads on them and no I/Os are left floating. The latter will happen to unconnected I/O pins unless they are configured as pull-up, pull-down or output.
The P1_0 and P1_1 pins do not have pull-up or pull-down functionality and should therefore be set as outputs if they are not connected, such as on the SOC_BB board. Also on the EB, these pins could float (I am not sure what the input characteristics of the circuit that they are connected to is). They should thus be configured as outputs. On the SOC_BB, the LED must be disconnected (or at least the output must be high so that the LED is off). On the EB there is a lot of load on all the pins, and thus it is difficult to control the power consumption.
One more thing to keep in mind: If the system is in debug mode, it will not enter a true PM2/PM3, but emulate it using a mode with similar current consumption as PM1. So when testing power consumption in power modes, do not run the program from the debugger, but start from reset by pushing the reset button or powering down and up.
Hi,
I tried the following
P0SEL &= 0x80;
P0DIR = 1;
P0 = 0;
P0SEL &= 0x40;
P0DIR = 1;
P0 = 1;
Trying to make P00 low and P01 high.
It does not work.
Any suggestions?
Regards