Modusbox Memcmp error

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

cross mob
jeje_2937166
Level 3
Level 3
10 questions asked 25 sign-ins 10 replies posted

Hi 

 

I am using cyw20706 on MudusBox SDK

 

I used memcmp to compare array and string

But, when I compare "AT+IOSSERIAL"  and "AT+IOSTEAMID", memcmp return 0.

"AT+IOSSERIAL" and  "AT+IOSTEAMID" are different. 

 

why are you doing this

0 Likes
1 Solution
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

I tested the hal_gpio demo about the API, there is no problem.

The code snip is as follows:

APPLICATION_START( )
{
char test1[] = { 'A', 'T', '+', 'I', 'O', 'S', 'S', 'E', 'R','I', 'A', 'L' };
char test2[] = { 'A', 'T', '+', 'I', 'O', 'S', 'T', 'E', 'A','M', 'I', 'D' };
uint8_t com_result;

wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_PUART );
wiced_hal_puart_select_uart_pads( WICED_PUART_RXD, WICED_PUART_TXD, 0, 0);

WICED_BT_TRACE( "GPIO application start\n\r" );

wiced_bt_stack_init( sample_gpio_app_management_cback,NULL,NULL);

if(memcmp(test2, test1, 12) == 0)
{
WICED_BT_TRACE("strings are same\n");
}
else
{
WICED_BT_TRACE("different strings\n");
}
}

 

And the log is :

GPIO application start

different strings

sample_gpio_app_management_cback 21

sample_gpio_app_management_cback 0

gpio_test_led

View solution in original post

0 Likes
1 Reply
Owen_Zhang123
Moderator
Moderator
Moderator
5 questions asked 500 solutions authored 250 sign-ins

I tested the hal_gpio demo about the API, there is no problem.

The code snip is as follows:

APPLICATION_START( )
{
char test1[] = { 'A', 'T', '+', 'I', 'O', 'S', 'S', 'E', 'R','I', 'A', 'L' };
char test2[] = { 'A', 'T', '+', 'I', 'O', 'S', 'T', 'E', 'A','M', 'I', 'D' };
uint8_t com_result;

wiced_set_debug_uart( WICED_ROUTE_DEBUG_TO_PUART );
wiced_hal_puart_select_uart_pads( WICED_PUART_RXD, WICED_PUART_TXD, 0, 0);

WICED_BT_TRACE( "GPIO application start\n\r" );

wiced_bt_stack_init( sample_gpio_app_management_cback,NULL,NULL);

if(memcmp(test2, test1, 12) == 0)
{
WICED_BT_TRACE("strings are same\n");
}
else
{
WICED_BT_TRACE("different strings\n");
}
}

 

And the log is :

GPIO application start

different strings

sample_gpio_app_management_cback 21

sample_gpio_app_management_cback 0

gpio_test_led

0 Likes