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.

Using the ADC in the CC2530

Other Parts Discussed in Thread: CC2530, Z-STACK, CC2531, PACKET-SNIFFER

I am using the CC2530 to transmit wireless signals for monitoring, so I need to access the internal ADC and transmit the data from the ADC to another CC2530 chip.  Is there any sample code for using the ADC and transmitting/receiving this data through the ZigBee protocol?  I came accross an ADC.c file and it's header file, but I was not able to compile it because of undefined variables in the code.

  • I was able to compile the adc.c file by including the iocc2530 header file in the adc.c file.  Now I am trying to integrate the data returned through the adc.c file into the basicRF functions in the light_switch.c  file that is from the software examples.  Any help on this process or a suggestion for using another file would be greatly appreciated.

  • I would suggest looking at the SimpleApp example found in the Z-Stack example projects directory from the Z-Stack CC2530 v2.2.0.
    <install directory>\ZStack-CC2530-2.2.0-1.3.0\Projects\zstack\Samples\SimpleApp

    This example uses the ADC to measure the temperature and battery voltage.

  • Thanks Brandon.  Do you know if it is possible to transmit and receive data at the same time?  I am trying to transmit the adc data to a second chip continuously, but I also want to send some basic commands from the second chip to the first chip.  How can I interrupt the transmitting process and check if the second chip is sending information to the first chip? 

    I was looking in the basicRF.c file and noticed there are some macros like basicRfPacketIsReady, and was wondering if I could check for that inside my main loop in my primary chip.  I was thinking something like:

    while(!basicRfPacketIsReady){

    //perform transmission of adc data

    }

    I don't know if this will work though because the primary chip may not be able to be receiving the packets from the secondary chip while the primary is transmitting?  Any ideas?

  • Danny said:

    Do you know if it is possible to transmit and receive data at the same time?  I am trying to transmit the adc data to a second chip continuously, but I also want to send some basic commands from the second chip to the first chip.  How can I interrupt the transmitting process and check if the second chip is sending information to the first chip? 

    The Z-Stack ZigBee stack provides for this to occur.  You can not literally transmit and receive at the RF level at the same time, but the Z-Stack provisions for a callback routine that can be used to perform processing based on received data and also setup timers to allow you to make calls to send data.  The SimpleApp example is the simplist implementation to review.

     

    Danny said:

    I was looking in the basicRF.c file and noticed there are some macros like basicRfPacketIsReady, and was wondering if I could check for that inside my main loop in my primary chip.  I was thinking something like:

    while(!basicRfPacketIsReady){

    //perform transmission of adc data

    }

    I don't know if this will work though because the primary chip may not be able to be receiving the packets from the secondary chip while the primary is transmitting?  Any ideas?

    I don't suggest you operate at that level.  You should be interacting with the zb_SendDataRequest() and zb_ReceiveDataIndication() level.

  • I tried implementing the basicRf commands that are in the light switch example from the software examples.  It uses a lot of HAL functionalities, and when I disconnect the EM from the EB and supply power to the appropriate pins, the CC2530 no longer communicates with my other CC2530 that is connected to the EB.  Do HAL functions require communication with the EB? 

    I noticed that in the ADC functions that the simpleApp uses, it uses hal_adc.c, therefore I am afraid that I will encounter the same problem when I remove the device from the EB.

    Do you know if this will be true?  If so how do I use the ADC without HAL, and use the ZigBee functions because my CC2530 will be mounted to a PCB and not attached to the development kit? 

    Thanks.

     

     

  • Hey Danny,

    I am facing a similar problem. When I power the CC2530 EM separately it stops communicating with the CC2530 mounted on an EB. Did you figure out what the problem was and how to solve it?

    I would appreciate it, if you could provide some help.

    Thanks,
    Rohit

  • Rohit, I got it working by connecting the reset pin to Vdd since the reset is active low.  You should have 3 pins connected to Vdd and 2 connected to GND.

  • Hey Danny,

    Thanks for the prompt response. I did as you said.. but I am still not getting it.

    Did you remove the EM from the SmartRF05 EB board and then applied it the supply voltage (taking care of the reset and all) ? Or did you have to make some other connections along with the ones that you mentioned?


    Thanks,

    Rohit

  • Yes I removed the EM from the EB and I supplied the power to the EM through 30 awg wire that I folded back and twisted to make it thicker and not slide out of the connectors on the EM.

  • Hey Danny,

    Thanks for the help. It works now. But I had to do something peculiar. I had to keep the P2.0 grounded to make it work. I am not sure why that is required? 

    Anyway, thanks a lot.

    Rohit

  • Hi,

    I am trying to use the simple.app.

    My configuration is 2 cc2530edk, CCdebugger and cc2531 usb dongle.

    Once I set one cc2530 as simple controller and one as sensor, how can I visualize the data?

    Regards,

    Filippo

  • Hi Filippo,

    For future posts, please open a new thread, and not post to a very old thread. To view pkt exchange b/w Coordinator and sensor node, you may use Free TI Packet sniffer tool : http://www.ti.com/tool/packet-sniffer or 3rd party tool Ubiqua http://www.ubilogix.com/products/ubiqua  with CC2531 USB dongle.

    Thanks,

    Saurabh