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.

Need help with the sample code( Data transmission/polling/sending ADC values wirelessly) cc2530

Other Parts Discussed in Thread: CC2530

hello guys,

i have been trying to figure out how to send data wirelessly using cc2530ZNP ZDK mini kit. I know i can change the timer on the inittimer(); to transmit data at a faster interval by changing the following line:

signed int timerResult = initTimer(4, WAKEUP_AFTER_TIMER);

If I change the 4 to 1 then it would be transmitted every second. My question now is what is the lowest time I can achieve? I am basically trying to send an ECG signal wireless, hence, I need the ADC to sample more often such that I can get enough samples to reconstruct the waveform. As far as I have understood the program simple application code from ti (   6661.8032.1121.7610.IAR.zip   ) the timer interrupt wakes up the HAL and acquires a sample of the waveform every four seconds. which is not sufficient enough data, as the ECG waveform will be around 1-2 Hz. 

CAN SOMEONE SUGGEST ME A SIMPLE WAY AS TO HOW I COULD SAMPLE MORE DATA EVERY SECOND!!

P.S. based on the link(  http://www.slideshare.net/SreekeshPadmanabhan/design-issues-in-cc2530-znp-multi-hop-sensor-networks-27234477  ) I found out it takes around 108 millisecond for the events during the complete packet transmission.[ Table 5 ].

Thanking you in advance,

Nischal Venugopal

  • Hi,

    I am moving this query as it refers to how to use ADC and sample data more often than with a granularity of 1 sec on MSP430 and you are just using the CC2530 firmware as a communication mean.

    This forum is about  ZigBee related question.

    On the ZigBee side, you can safely assume that data can be exchanged between nodes at single hop radio distance as fast as 20-50 msecs.

    Please also note that the ZNP mini-kit is being phased out and replaced by this kit http://www.anaren.com/air/cc2530-boosterpack-kit

    Thanks,

    TheDarkSide

  • Hi darkside,

    I kinda have already figured out the Adc and the protocol part, However isn't the mini kit/the znp protocol use the zigbee protocol?? If so, like you say I should be able to transmit the values/ wakeup the adc for the samples every 20 ms. When this is right, how do I do it???

    P.S :

    I meant transmitting the adc value when I meant sampling it faster: coz the Adc is triggered to sample every 4 secs !!! I just want to trigger the adc for the values more often, which would give me faster transmission rate !!

    If you still feel that it is not related to communication/transmission of the values, then please help me out by moving my post :)

     

    Thanking you,

    Nischal

  • Hi Nischal,

    yes, ZNP mini-kit is using ZigBee protocol but the way I understood your setup has been built up, you're using the MSP430 ADC module and the function you mentioned is running on the MSP430 core.

    Is my understanding correct?

    If that's the case, then you are just using the ZNP firmware (ie the the 2530) as a data pipe. 

    That pipe will provide you the capability to send data very fast (as mentioned, every 20-50 msec to the next radio hop) but what you are asking is how you can generate samples from the ADC on the MSP430 at a faster rate than 1 sec using the MSP430 code. 

    Once you solved that problem, you can use the ZNP API to send the data over to the ZNP via the SPI interface.

    To transfer the data over to ZNP via SPI, please refer to the AF_DATA_REQUEST API in the 2530ZNP Interface specification document.

    Thanks,

    TheDarkSide

     

  • Hi Darkside,

    You are absolutely right, the MSP430 is the one generating the ADC values and the ZNP is used as the data pipe to send these values wireless through the zigbee protocol. However, If you take a look at the attached zip file, you will find a  code example workspace named [Simple Application]. In this example, the data is send either by Motion or by a Timer. The timer is configured to send the data every 4 seconds; meaning I am receiving each data packets at 4 secs interval. the ADC is very well capable of generating higher sampling rate about 200 Ksps. The problem is: since it is a Timer generated request, the CC2530 polls for data from the 2274 every 4 secs, and I can get only one data packet every 4 secs.

    #ifdef SEND_MESSAGE_ON_TIMER
    signed int timerResult = initTimer(4, WAKEUP_AFTER_TIMER);

    The above Code shows me how often the Message is transmitted.

    I will definitely take a look into the AF_DATA_REQUEST API at the interface specifications, But, I would like to know How do i change this timer in such a way that it polls for data more often such that it can be sent wirelessly more often; giving me a rate of 20 ms (or lesser) as you mentioned. If i can get an explanation as to, how to achieve faster transmission rates on the Timer generated Request( i.e. change the timer to poll for data faster or in general, to wake up the MSP430 to make ADC conversions), I can make according changes to my program and successfully obtain my desired results.

    Thanking you,

    Nischal Venugopal

  • Hello Darkside,

    I finally figured out how to transmit data packages at a faster rate, all i had to do was looking into the timer functions and its routine. By changing the count on the Timer i was able to generate faster transmission rate. However, I have one final question:

    The End device is running at a high speed sending data, lets say at every 50ms. However, the coordinator is receiving them at every 150ms or so..... why is this happening. I don't get this because the coordinator is not put to sleep anywhere in the code, which means it has to keeping receiving and display data according to the End device sending rate. Is it delayed any chance by the use of serialize message and deserialize message in the coordinator?? you would be of great help if could answer me to the addressed question. FINGERS CROSSED ;)

    P.S. In case you need to take a look at the code yourself here is the zip file containing different workspaces and i am using the one called as SIMPLE APPLICATION

     8880.2210.CC2530ZNP.zip

    Thanking you,

    Nischal

  • In a single hop node network the coordinator should be able to receive the data within a very short turnaround time, if you are sending the ADC values in a single packet.

    It is very unlikely that it would take him 150 msecs. if you pull a sniffer log you should be able to see how fast the 2530 radio on the coordinator acknowledges the data sent by the end device. You should be able to see that the turnaround is very fast (like below 10 msecs). Then i suggest you timestamp the data sending over the serial port.

    Stack processing time should be few msecs so really what you need to take a look at is how long it takes for the data to be serialized.

    The numbers you report seem very big and very strange.

    Thanks,

    TheDarkSide 

     

  • Hi Darkside,

    Thank you for the quick reply. The data through the serial port is time stamped, this is how I got to know that the coordinator is receiving data packets every 150ms. And how do I check how long the serialize function takes ?? Because even I had the same doubt that it is the process of serializing and deserializing that is taking time, but didn't know how to measure this function.  Should I this use a parser or something like that ?? Could you please give me a suggestion how to do this ? 

    Thanking you

    Nischal