cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Studio Bluetooth

daba_4649501
New Contributor II

hello,

i am using cybt-413034-02 module and i want to send and receive data through PUART , i can able to print the data but i cant able to write or read the data from call back function.

i am using wiced studio 6.4 and version is WICED-SDK Version: Wiced_006.004.000.0061

i am using this code and called test_puart_driver.

please help,

APPLICATION START()

{

test_puart_driver();

}

void puar_rx_interrupt_callback(void* unused)

{

    // There can be at most 16 bytes in the HW FIFO.

    uint8_t  readbyte;

    wiced_hal_puart_read( &readbyte );

    /* send one byte via the TX line. */

    wiced_hal_puart_write( readbyte+1 );

    if( readbyte == 'S' )

    {

        /* send a string of characters via the TX line */

        wiced_hal_puart_print( "\nYou typed 'S'.\n" );

    }

    wiced_hal_puart_reset_puart_interrupt( );

}

/* Sample code to test puart driver. Initialises puart, selects puart pads,

* turn off flow control, and enables Tx and Rx.

* Echoes the input byte with increment by 1.

*/

void test_puart_driver( void )

{

    uint8_t read_5_bytes[5];

    wiced_hal_puart_init( );

    // Possible uart tx and rx combination.

    // Pin for Rx: p2, Pin for Tx: p0

    // Note that p2 and p0 might not be avaliable for use on your

    // specific hardware platform.

    // Please see the User Documentation to reference the valid pins.

#if defined(CYW20706A2)

    wiced_hal_puart_select_uart_pads( WICED_PUART_RXD, WICED_PUART_TXD, 0, 0);

#endif

    /* Turn off flow control */

    wiced_hal_puart_flow_off( );  // call wiced_hal_puart_flow_on(); to turn on flow control

    // BEGIN - puart interrupt

    wiced_hal_puart_register_interrupt(puar_rx_interrupt_callback);

#if !defined(CYW20706A2)

    //set watermak level to 1 to receive interrupt up on receiving each byte

    wiced_hal_puart_set_watermark_level(1);

#endif

    /* Turn on Tx */

    wiced_hal_puart_enable_tx( ); // call wiced_hal_puart_disable_tx to disable transmit capability.

    wiced_hal_puart_print( "Hello World!\r\nType something! Keystrokes are echoed to the terminal ...\r\n");

    /* Enable to change puart baud rate. eg: 9600, 19200, 38200 */

    wiced_hal_puart_set_baudrate( 115200 );

}

0 Likes
1 Solution
3 Replies
AnjanaM_61
Moderator
Moderator

Hello daba_4649501 ,

Seems like you are referring demo example available in WICED. Demo example will work file.

Only thing you need to recheck is the pins . Please check if you have selected correct PUART pins for cybt-413034- , if you are using cybt-413034- EVAL board.

Also please note, if you are using WICED 6.4, then you have to use the patch files available here along with the platform files for cybt-413034

Platform and New Patch Files For 20719B1 in WICED 6.4.0.61 - KBA228518

Thanks,

Anjana

0 Likes
daba_4649501
New Contributor II

hello anjana,

i can able to view the trace in puart and can print in puart but problem is that call back function is not returning anything

thanks and regards,

danny

0 Likes