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.

CC2530: Empty loop time delay time in firmware

Part Number: CC2530
Other Parts Discussed in Thread: Z-STACK

To whom it may concern,

Originally, I am using CC2530.  I want to capture UART signal(4800bps) from  other IC.  I use empty loop delay time elapse method to capture UART data. At the beginning, the bit width timing is set OK, UART data correctly capture. But later I discovered that the empty loop delay time will automatically change when I make some other parts of the firmware, I suspect that program interrupt occur during data capture. then I try EA=0/ EA=1 to disable interrupt during data capture but the problem still remain. I don't know why. Please see the attachment for detail.

 

Thank you very much

Bruce Lam

2018_08_01 07-54-49.pdf

  • Do you use Z-Stack? If so, there’s UART driver inside and you can use it directly.
  • Dear YK,

    I use Zstack. But I am not using UART driver to get this UART data. It is because the external IC will continuously send this UART data out to CC2530. Also, I don't need to keep update this UART data (i.e., sometime when I need, I will then capture the data.) So, I just use time delay method to get the UART data.

    But the most strange thing I cannot figure out is that why the time elapse in the time delay loop(just an empty "for" loop ) will change automatically when I do some other portion of the firmware program. (P.S. the time elapse is a little change, e.g., 0.208ms to 0.238ms, but this change will make the UART capture unsuccessfully)

    Thank you very much
    Bruce Lam
  • I think it is not accuracy to use for-loop as delay function since other interrupts might cause in accuracy.
  • Hello Bruce,

    It is not good practice to disable all interrupts unless you are writing flash using the CPU, which is done to ensure that this specific operation does not time out. Ignoring this advice could cause failure of important modules like RF (for Zigbee communication) and timers. Polling UART RX using a for loop delay is not advised nor sustainable, please utilize the USART module and simply disable it when not needed.

    Regards,
    Ryan