PUART TX can't work on 20737

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

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.

0 Likes
1 Solution
Anonymous
Not applicable

Thanks all. The root cause to the issue is the voltage. The signal on PIN 32 and PIN 33 from J8/J9 is 1.8V and the external device only can work with 3.3 V.  If we fly wire from the 3.3 V ( the pin after the MAX.. IC). The UART can work.

View solution in original post

0 Likes
5 Replies
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

Have you looked at /WICED-Smart-SDK/Apps/uart_firmware_upgrade as it provides a functional example for the PUART.

In addition, vik86 will be updating this thread created by tedlogan today with functional PUART code as well: How can I reassign port pins to GPIO after they have been assigned to puart_tx and puart_rx?

In addition, I think embeddedmasters attached a sample program that he create which also uses the PUART.

Anonymous
Not applicable

Mwf_mmfae,

     Yes. I read the API and related topics in this forum. But the codes I posted is quiet simple and haven't find the error which cause the TX can't work.

0 Likes

Would you want to disable power saving mode and try again?

Use this function and return 0 from the callback so chip won't go to power save.

BOOLEAN devlpm_registerForLowPowerQueries(DeviceLpmQueriableMethodCallback callback, UINT32 context)

0 Likes
Anonymous
Not applicable

Thanks all. The root cause to the issue is the voltage. The signal on PIN 32 and PIN 33 from J8/J9 is 1.8V and the external device only can work with 3.3 V.  If we fly wire from the 3.3 V ( the pin after the MAX.. IC). The UART can work.

0 Likes

Thanks for sharing the solution with us easyit!

vik86 j.t

0 Likes