cancel
Showing results for 
Search instead for 
Did you mean: 

WICED Smart Bluetooth

Anonymous
Not applicable

Hi all,

I use puart to connect extra device.

I will send command to my extra device.


If the extra deive receives the command,it will send sensor data(11 Byte) back.


I send five command to the extra device.


I use the buffer to save the sensor data in the rx call back function.

And then I print the buffer in Timer.

But the sensor data is wrong,I receives some wrong data like 0xff.

Correct sensor data:

*1------------------------------------------------------------

01 04 06 04 BF 15 70 0A C8 76 2D

01 04 06 04 BF 15 6D 0A C8 E6 2B

01 04 06 04 BF 15 70 0A CA F7 EC

01 04 06 04 BF 15 6E 0A CA 97 EA

01 04 06 04 BF 15 70 0A C9 B7 ED

*2------------------------------------------------------------

01 04 06 04 DA 15 40 0A C5 FB EF

01 04 06 04 DA 15 41 0A C7 2B EE

01 04 06 04 DA 15 42 0A C5 5A 2F

01 04 06 04 DA 15 43 0A C4 CA 2F

01 04 06 04 DA 15 45 0A C9 EB EB

*3--------------------------------------------------------------

01 04 06 04 C7 15 A0 0A BC D7 F9

01 04 06 04 C7 15 A1 0A BC 86 39

01 04 06 04 C7 15 A0 0A BB 96 3B

01 04 06 04 C7 15 A0 0A BB 96 3B

01 04 06 04 C8 15 9D 0A BD D3 F4

*4----------------------------------------------------------

01 04 06 04 E1 15 24 0A CB DE 31

01 04 06 04 E1 15 22 0A CB 3E 30

01 04 06 04 E1 15 20 0A CA 5E 30

01 04 06 04 E1 15 20 0A CA 5E 30

01 04 06 04 E1 15 1E 0A CA 3F FC

*5---------------------------------------------------------------

01 04 06 04 FB 15 35 0A C1 57 F1

01 04 06 04 FB 15 35 0A C2 17 F0 

01 04 06 04 FA 15 36 0A C1 9A 31 

01 04 06 04 FA 15 36 0A C2 DA 30

01 04 06 04 FB 15 38 0A C1 C6 32

Buffer data(save the sensor data in the rx call back function):

*1------------------------------------------------------------

01 04 06 04 BF 15 70 0A C8 76 2D

FF FF FF 01 04 06 04 BF 15 6D 0A C8 E6 2B

FF FF 01 04 06 04 BF 15 70 0A CA F7 EC

01 04 06 04 BF 15 6E 0A CA 97 EA

FF FF 01 04 06 04 BF 15 70 0A C9 B7 ED

*2------------------------------------------------------------

FF 01 04 06 04 DA 15 40 0A C5 FB EF

FF FF 01 04 06 04 DA 15 41 0A C7 2B EE

01 04 06 04 DA 15 42 0A C5 5A 2F

FF FF 01 04 06 04 DA 15 43 0A C4 CA 2F

FF 01 04 06 04 DA 15 45 0A C9 EB EB

*3--------------------------------------------------------------

01 04 06 04 C7 15 A0 0A BC D7 F9

FF FF 01 04 06 04 C7 15 A1 0A BC 86 39

FF 01 04 06 04 C7 15 A0 0A BB 96 3B

FF 01 04 06 04 C7 15 A0 0A BB 96 3B

01 04 06 04 C8 15 9D 0A BD D3 F4

*4----------------------------------------------------------

01 04 06 04 E1 15 24 0A CB DE 31

FF FF 01 04 06 04 E1 15 22 0A CB 3E 30

FF FF 01 04 06 04 E1 15 20 0A CA 5E 30

FF 01 04 06 04 E1 15 20 0A CA 5E 30

FF 01 04 06 04 E1 15 1E 0A CA 3F FC

*5---------------------------------------------------------------

01 04 06 04 FB 15 35 0A C1 57 F1

FF 01 04 06 04 FB 15 35 0A C2 17 F0

FF FF 01 04 06 04 FA 15 36 0A C1 9A 31

FF 01 04 06 04 FA 15 36 0A C2 DA 30

FF FF 01 04 06 04 FB 15 38 0A C1 C6 32

It will receive some wrong data like FF in my buffer.

This is my code:

/********************************************************************

*  PUART receives call back function

********************************************************************/

static void application_puart_interrupt_callback(void* unused){   

    UINT8 readbyte;

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

        test_buffer[test_pointer++]=readbyte; 

    }

    P_UART_INT_CLEAR(P_UART_ISR_RX_AFF_MASK);

    P_UART_INT_ENABLE |= P_UART_ISR_RX_AFF_MASK;     

}   

UINT32 application_send_bytes(UINT8* buffer, UINT32 length){

    UINT32 ok = length;

    if(!buffer || !length)

        return 0;

    while(length--){

        puart_write(*buffer++);

    }

   

    return ok;

}

/********************************************************************

*  Software Timer(App timer) call back function

*   Timer time = 1 sec

********************************************************************/

void send_command_timeout(void){

     timer_counter++;

    application_send_bytes(&send_command, sizeof(send_command));  //send command to extra device

    if(timer_counter==8){

         application_send_bytes(&test_buffer, sizeof(test_buffer));

    }

}

0 Likes
1 Solution
Anonymous
Not applicable

The error data is our hardware bug.

I fix the hardware bug,and the puart is work fine.

Thanks for your help.

View solution in original post

0 Likes
3 Replies