5 Replies Latest reply on Dec 12, 2014 6:34 AM by MichaelF_56

    PUART TX can't work on 20737

      Hi,

          I am tring to work on PUART by 20737TAG EVK. The RX can work but the TX over PUART can't. Here is the code.

          1. Copy hello sensor to one new directory.

          2. In INIT function:

      APPLICATION_INIT()

      {

          bleapp_set_cfg((UINT8 *)hello_sensor_gatt_database,

                         sizeof(hello_sensor_gatt_database),

                         (void *)&hello_sensor_cfg,

                         NULL,

                         (void *)&hello_sensor_gpio_cfg,

                         hello_sensor_create);

       

          //BLE_APP_ENABLE_TRACING_ON_PUART();     ////// Uncomment to disable all tracing

          //BLE_APP_ENABLE_TRACING_ON_HCI_UART();

      }

       

      3. In hello_sensor_create

          at the end of the function

                  init_my_uart();

              4. Inside init_my_uart()

      {

          ble_trace0("Init uart port\r\n");

          puart_selectUartPads(33,32,0,0);

          puart_init();

          puart_setBaudrate(0,0,115200);

          puart_flowOff();

       

          /* Clear INT */

          P_UART_INT_CLEAR(P_UART_ISR_RX_AFF_MASK);

       

          P_UART_WATER_MARK_RX_LEVEL(1);

          P_UART_WATER_MARK_TX_LEVEL(0);

       

          P_UART_INT_ENABLE |= P_UART_ISR_RX_AFF_MASK;

          {

              UINT8 readbyte;

              // empty the FIFO

              while(puart_rxFifoNotEmpty() && puart_read(&readbyte))

              {

                  (void)(readbyte);

              }

          }

       

          puart_rxCb = my_uart_rx_callback;

          puart_enableTx();   

       

          puart_enableInterrupt();

      }

      5. Test send function in timer

      void uart_send_test_char_kkk(void)

      {

          UINT8 a='c';

          puart_write(a);

          a='d';

          puart_write(a);

          a='e';

          puart_write(a);

              a='\r';

          puart_write(a);

              a='\n';

          puart_write(a);

      }

       

              I have tried 115200/38400 and both can't work in the TX direction. But the RX works fine.