Hi, all! I'm new at both ZigBee and programming for the CC2530. I apologize if my questions have been answered elsewhere, but I've looked and looked and not found them. I'm using Z-Stack 2.3.1 with the CC2530ZDK, which includes the RF05EB. I've been modfiying the Sensor Demo application on both the Sensor and Collector sides, using IAR EW.
I'd like to set a GPIO bit high just before I send out a series of 10 packets on the radio, and have it go low again once the packets are transmitted, but this seems much harder to do than I expected. It's easy to set the GPIO bit (I highjacked the LED3 signal) in response to an incoming command message. But the RF output responses do not come when I think they should. In fact, they almost never seem to come with the GPIO bit set high, as if the CPU won't issue the transmit commands while the LED3 signal is high. Typically I see one output RF pulse (detected in the time domain using a wideband RF log-detector) 5 msec before the GPIO bit goes high, which I'm guessing is an ACK response. There are also RF pulses roughly every 80-100 msec after the bit goes low. which I think may be my response packets.
I originally tried doing this from within the zb_HandleOsalEvent function (in the DemoCollector.c app), but I thought that the OSAL event handler may not be as deterministic in terms of signal timing. So, now I've got it in the zb_ReceiveDataIndication function, but the move did not seem to change things in any significant way.
It looks to me now like the radio transmits when it's ready, and not in any way that's synchronous with the CPU, or at least with the application layer. Is that correct? Is this because the zb_SendDataRequest puts the data in a queue in the CSP? If so, I'm wondering if there's a way to give commands more directly to the radio. In particular, the maxTxFrameRetransmit() function looks like it would be perfect, but I don't think you can call that function from the application - at least I have not been able to do so successfully. I also tried reading the TX_ACTIVE register, but I think it's changing too fast for the application to catch it.
Is there documentation I can look though which describes how the CC2530 radio commands and application timing are related? The CC2530 User Guide does not seem to cover this, and I've found nothing in any of the Z-Stack API documents. The routine I'm playing with is given below.
void zb_ReceiveDataIndication( uint16 source, uint16 command, uint16 len, uint8 *pData )
{
if ( command == SENSOR_REPORT_CMD_ID )
{
HalLedSet ( HAL_LED_2, HAL_LED_MODE_FLASH ); // Flash LED 2 once to indicate data reception
osal_stop_timerEx( sapi_TaskID, MY_REPORT_EVT ); //Stop default timer
osal_clear_event( sapi_TaskID, MY_REPORT_EVT ); //Clear any report events outstanding
zb_SendDataRequest (gtwData.source, MEASURE_CMD_ID,1,10, 0,0,0);
P1_4 = 1; // Set signal bit high (on RF05 board, EM_CS/EM_LED3_SOC signal on Port1.4 is asserted).
// Send out 10 duplicate commands.
for (uint8 n=0; n<10; n++)
{
zb_SendDataRequest (gtwData.source, MEASURE_CMD_ID,1,10, 0,0,0);
}
P1_4 = 0; // Set signal bit high (on RF05 board, EM_CS/EM_LED3_SOC signal on Port1.4 is asserted).
}
}
Thanks in advance for any pointers, insights, or suggestions!
ebok