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.

Question about using CC2530 UART ISR to interfacing RS485 under Z-stack

Other Parts Discussed in Thread: CC2530, Z-STACK

I am trying to use CC2530 with MAX3485 chip to interface RS485 device with the instructions in following discussion: http://e2e.ti.com/support/low_power_rf/f/158/t/131050.aspx

The code works perfectly when I use BasicRF as environment. However, the same code does not work with SampleApp in Z-Stack 2.5.1a. I have tried to set following options for the project (1) HAL_UART=TRUE, (2) UART_DMA=FALSE, and (3) UART_ISR=TRUE. The IAR compiler doesn’t seem to compile the hal_uart.c with _hal_uart_isr.c because it doesn’t show any message whenever I put an error code into _hal_uart_isr.c. I have tried to forcing hal_uart.c code to compile _hal_uart_isr.c and corresponding function by removing some #if .. #endif macros. But the code still doesn’t work. Any idea why? Thanks.

  • Try "#define HAL_UART_DMA  0" and "#define HAL_UART_ISR  1".

  • Thanks for replying, YiKai.

    However, I have tried following different settings and got different results from HalUARTWrite and HalUARTRead function.

    <Case 1: Define "HAL_UART_DMA 0 and UAL_UART_ISR 1" in hal_board_cfg.h>
    Lots of warning messages like this "incompatible redefinition of macro "HAL_UART_ISR"". And the HalUARTWrite/Read functions all return 0 which illustrates nothing has been written/read.

    <Case 2: Define "HAL_UART=TRUE, UART_DMA=FALSE, UART_ISR=TRUE in compile option>
    No warning messages in compilation. The HalUARTWrite function shows all bytes are successfully send to RS485 device. However, the HalUARTRead cannot read anything from RS485 device.

    <Case 3: Both defines in hal_board_cfg.h and compile option are set>
    No warning messages in compilation. The HalUARTWrite function shows all bytes are successfully send to RS485 device. However, the HalUARTRead cannot read anything from RS485 device.

    Any idea why this happened? Thanks.

  • I would suggest you to check RX with scope to make sure there are signal on it.

  • I connect the CC2530 (with RS485)  to a USB-to-RS485 converter.

    And I found out that the message can go from cc2530 to PC via RS-485 without a problem.

    However, anything I have keyed in to the terminal can not be received by CC2530 via RS-485 interface.

    Whenever I tried to control the direction pin (P1.3 in my case) of MAX3485, the direction won't change.

    I have tried to put it into ISR as the previous article and right after called HalUARTRead/Write, but both of them doesn't work. The transmission direction still goes in one way @@.

  • Hi all,

    I've the same problem, did you solve it? 

    thank you

    Regards,

    Emanuele

  • Hi Emanuele,


       I managed to get it work under Z-stack. The problem is the initialization of connected port/pin.

    I operate control registers directly (P0DIR |= ... ) to set port/pin direction for control pin, and the RS485 chip works successfully.