How can I send data through HCI UART without using ClienControlMesh APP?

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

cross mob
jama_4535901
Level 3
Level 3
10 sign-ins 5 sign-ins 25 replies posted

Hello, I want to know how I can print messages through the HCI UART port?

I am using modustoolbox and CYBT-213043-MESH board

I know that to send through the perhypal port the following function is used

uitn8_t data_print [4] = {0x01,0x02,0x03,0x04};

WICED_BT_TRACE ("Data% B \ n", data_print);

but I want to know how to print in the same way on the UART HCI port and this data is printed on a serial terminal

0 Likes
1 Solution

Hi,

If you just wanted to route the debug prints to HCI UART, please make the following change in mesh_app_hci.c

Please note, the default baudrate would be 3000000.

Capture.PNG

Thanks,

-Dheeraj

View solution in original post

0 Likes
6 Replies
AnjanaM_61
Moderator
Moderator
Moderator
5 comments on KBA First comment on KBA 5 questions asked

Hi jama_4535901 ,

For routing debug logs to HCI UART. Please use the below API :

wiced_set_debug_uart(WICED_ROUTE_DEBUG_TO_HCI_UART);

Regards,

Anjana

0 Likes

So, should the code look like this?

uitn8_t data_print [4] = {0x01,0x02,0x03,0x04};

wiced_set_debug_uart(WICED_ROUTE_DEBUG_TO_HCI_UART);

WICED_BT_TRACE ("Data% B \ n", data_print);

but I think it doesn't print on the HCI port

Can you tell me how the code should be, please?

0 Likes

excuse me

Could you give me a complete code example or help me make the code so that I can print any message through the HCI port?

0 Likes

Hi jama_4535901 ,

You Just need to make sure you have set the baud rate in wiced_transport_init For example :

/* transport configuration */

const wiced_transport_cfg_t transport_cfg =

{

    .type = WICED_TRANSPORT_UART,

    .cfg =

    {

        .uart_cfg =

        {

            .mode = WICED_TRANSPORT_UART_HCI_MODE,

            .baud_rate =  115200

        },

    },

    .rx_buff_pool_cfg =

    {

        .buffer_size = 0,

        .buffer_count = 0

    },

    .p_status_handler = NULL,

    .p_data_handler = NULL,

    .p_tx_complete_cback = NULL

};

And in the Application_start ,  wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_HCI_UART );

But Please note, you should not hard reset the module after programming and opening the HCI COM port to see the logs from beginning.

You may rather open the HCI COM port , set the baud rate plug off the board and plug in again , you can see the debug logs.

Reference: Re: How to use HCI TRACE of CYBT-213043-MESH kit 

Regards,
Anjana

I already tried it

try to modify the code as shown in the image

But it does not work

I want the devices that are scanned in aplicacion.c to be printed on the hci port but it does not work, I do not know why, could you tell me what I can do?

hci.PNG

0 Likes

Hi,

If you just wanted to route the debug prints to HCI UART, please make the following change in mesh_app_hci.c

Please note, the default baudrate would be 3000000.

Capture.PNG

Thanks,

-Dheeraj

0 Likes