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.

uart in Z Stack GenericApp

Other Parts Discussed in Thread: CC2530

Hi Friends,

                   I want to implement my UART code in my Z Stack CC2530 GenericApp ,So I where to write the code for UART Init, Open ,send and receive function in GenericApp.c  file or hal_uart.c file.

Give me an idea to me.

  • You can check how UART is initializes and used in MT_UART.c .

  • HI YiKai Chen,

                             These files are also defined in hal_uart_isr.c so at which file I write the configuration code for UART in Z Stack.

  • You can copy the code in MT_UartInit to your own zclXXX_init.c, and make your own UART callback function like MT_UartProcessZAppData.

  • Hi YKC,

                  I tried the all UART module and debug the code, the debugger goes into HalUARTWriteISR function.

    but I doesn't print the data into hyper terminal.

    My Code:

    In GenericApp.c

    halUARTCfg_t uartConfig;
    /* Initialize APP ID */
      //App_TaskID = 0;
      /* UART Configuration */
     unsigned char str[]="Hello everybody";

     uartConfig.configured = TRUE; // 2x30 don't care - see uart driver.
     uartConfig.baudRate = HAL_UART_BR_115200;
     uartConfig.flowControl = TRUE;
     uartConfig.flowControlThreshold = 48; // 2x30 don't care - see uart driver.
     uartConfig.rx.maxBufSize = 128; // 2x30 don't care - see uart driver.
     uartConfig.tx.maxBufSize = 128; // 2x30 don't care - see uart driver.
     uartConfig.idleTimeout = 6; // 2x30 don't care - see uart driver.
     uartConfig.intEnable = TRUE; // 2x30 don't care - see uart driver.
     uartConfig.callBackFunc = NULL;
     HalUARTOpen (HAL_UART_PORT_0, &uartConfig);
     HalUARTWrite(HAL_UART_PORT_0, str, 15);

    and control goes into HalUARTWriteISR  function in _hal_uart_isr.c.

    My Q:

    1.I can't get the data into Hyper Terminal so what are the thinks I need to do?

  • Check your HW to make sure TX/RX pins are correct.

  • Hi YKC,

                  I am using UART0 so as u said I am using P0.2-RX and P0.3-TX in my board and I am using baudrate in hyper terminal what I used in my program HAL_UART_BR_115200.

    1.Can u give any idea where I did the mistake ?

    2.What are the details need my from side?

  • Do you enable flow control on your hyper terminal? You code looks without problem. If it is possible, I would suggest you using scope to check if there is any signal on your TX when you use uart write.

  • Hi YiKai Chen,

                              I am using check with scope but I can't get any data in my scope.

    Give any suggestion where I did the mistake?