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.

CC2430EB - how to enable UART reception in SampleApp

Other Parts Discussed in Thread: CC2430, MAX3222, MAX3232

Hello,

 

we have been using the Chipcon SmartRF04EB for a project, by implementing extra features into the provided SampleApp. Otherwise everything has been fine, but for some reason we can't get the UART RX interrupt to trigger at all. Transmitting from the board over UART works fine (Hyperterminal and our own utility receive the sent characters), and we have verified with a scope that the data does get sent to the board too, the software simply doesn't react to it. It might be something as basic as a pin input/output definition, but we haven't been able to trace the problem. We have tried to search and read all relevant threads, FAQ's and application notes, but so far, no luck. Any help or further links to study will be appreciated.

So the question is - what steps need to be taken to activate UART reception in SampleApp?

 

Thanks in advance!

  • I just want to confirm the software you have based your project on.  Is this the SampleApp in the ZStack-1.4.3-1.2.1?
    To confirm, ZStack-1.4.3-1.2.1\Projects\zstack\Samples\SampleApp?

    What compile options have you selected for the UART functionality?  There are several, so narrowing down to the exact set will help in the investigation.
    These options are in the Components\hal\target\CC2430EB\hal_board_cfg.h file.  By default, the DMA is used in conjunction with the UART.

    In this default configuration, interrupts are not used and te UART is polled via HalUARTPoll().  However, if interrupts are desired, the HAL_UART_DMA should be undefined and the HAL_UART_ISR should be used.

  • Yes, that is the SampleApp I am talking about. At the moment I have these defined in the compile options:

    HAL_UART=TRUE
    HAL_UART_ISR=TRUE
    HAL_UART_DMA=FALSE

    Should the DMA one indeed be completely undefined, rather than just marked false?

     

    Thank you for the quick reply!

  • I believe it is sufficient to leave it marked false.  It seems all of the #if statements are just that and not #ifdef.

    Are you also using HAL_UART_0_ENABLE?

    After you send a character to the UART, since you are not getting an interrupt, can you check the TCON.URX0IF flag to see if it is getting set?

  • akorhola,

    Maybe first try to get your sample app to work with Z-Tool.

    1. Have tried this?

    2. Try to use Hyperterminal to see if you can open the COM port

     

    LPRF Rocks the World

     

  • @BrandonAzbell

     

    I have HAL_UART_0_ENABLE  set to TRUE in the code, this is inside an "#if HAL_UART" so I believe it should get activated.

    I don't think I have looked at the interrupt flag you mentioned, will check that the next time we are testing this. As I said earlier, this can be something completely trivial - we haven't had an awful lot of time to get familiar with the inner workings of SampleApp, and it is after all a relatively large program.

     

    @LPRF

     

    I haven't really tried Z-Tool, no. Is there something that makes it worthwhile over just a regular terminal? I already know the COM port is opened and works, since we can receive stuff on the PC, the problem is reception on the evaluation board end. In effect we have one-way communication at the moment.

  • were you using UART with POWER_SAVING enabled?

    If the CC2430 is in sleep mode (PM2 or PM3) only external and timer interrupts can wake it up. So if data is received during sleep the interrupt will not trigger at all.

    for our part UART interrupt initialization was very simple:

      //set USART_RX interrupt bit in IEN0
      URX0IE =1;  

    Once this is done, we just created a handler and it can trigger the interrupt (when it is not in sleep mode)

    HAL_ISR_FUNCTION( halUart0RxIsr, URX0_VECTOR )...

    btw, you should setup the GPIO properly to work in its alternate function for it to work in UART mode.

  • Grant said:
    you should setup the GPIO properly to work in its alternate function for it to work in UART mode.

     

    Can you elaborate on this? The #if's don't take care of the port settings even if we have the HAL_UART etc. tokens defined? What is the proper way to do the setup?

     

    We started with a fresh project now, testing only the UART functionality, and ran across this message: "The UART will not work with this configuration. The RX & TX pins are used." - apparently it had already warned us earlier, but we had just commented the warning away not knowing what else to do about it [:(] What is the configuration this error refers to? The selection between "router" and "coordinator", or something else? Looks like at least the transmission part works despite the warning, which threw us off...

  • The #if's do take care of this.  In the HalUARTInit() routine, the HAL_UART_0_ENABLE and HAL_UART_1_ENABLE setup which pin multiplexing is required.

  • Hi,

    I'm not even being successfull with the transmission.

    Defined in the compile options:

    HAL_UART=TRUE
    HAL_UART_ISR=TRUE
    HAL_UART_DMA=FALSE

    But getting the error "The UART will not work with this configuration. The RX & TX pins are used."

    I'm also using the SmartRF04EB board, and SampleAPP with some modifications just to open and send bytes truth the uart.

    Because de pins 9 and 11 are used in the DemoEB to choose between Coordinator and Router, and they are the uart pins, i'm using the RouterEB.

    Thanks.

     

     

  • I couldn't make the serial transfer to the SmartRF04EB work neither. Then I used a CC2430DB with an external MAX3222 circuitry and it worked with the configuration defined above in this topic.

  • Hi,

    I am working with this example too. I have tried succesfully the example in 2 cc2430EB, reading and wrinting through the hyperterminal.

    I want to know if it is possible to read the same, but using the port0 for example. I tryed it connecting the port0 to he serial port with a max3232 in the middle, but I don´t see nothing. Do you know why? Is necessary to change the code? or any jumper?

     

    If anyone can help me, I would be very thankful.

  • In the compiler options make sure you the following flag : HAL_UART (for CoordinatorEB configuration)

    and in SampleApp_Init() add the following snippet:

    halUARTCfg_t uartConfig;

      uartConfig.configured           = TRUE;              // 2430 don't care.
      uartConfig.baudRate             = HAL_UART_BR_38400;
      uartConfig.flowControl          = TRUE;
      uartConfig.flowControlThreshold = 48;
      uartConfig.rx.maxBufSize        = 64;
      uartConfig.tx.maxBufSize        = 64;
      uartConfig.idleTimeout          = 6;                 // 2430 don't care.
      uartConfig.intEnable            = TRUE;              // 2430 don't care.
      HalUARTOpen (0, &uartConfig);

    and use the following function

     HalUARTWrite( 0, memPtr, len );

    memPtr is pointer of type uint8 and len is the number of bytes to write.

    I am able to use the UART on SmartRF04EB with the above configuration .

    Hope this helps.....