- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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));
}
}
Solved! Go to Solution.
- Labels:
-
Peripherhal UART
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The error data is our hardware bug.
I fix the hardware bug,and the puart is work fine.
Thanks for your help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Let me know if the below helps.
SDK2.2: puart_print or puart_write is not reliable, some sent data could be missed
Did you have a chance to do this on the tag3 and the provided sample app?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi boont,
Thank you for your reply.
This is my test architecture.
The costom board send command to extra device, and then the extra device will send data of senosr back.
I will send five command to extra device.
I use the buffer to store the data of senosr.
Then I will print the buffer to puart.
The PC will receive three messages.One is command of custom board,another is result of costom board,and the other is data of extra device.
I use serial monitor to observe the message.
The command and data of extra device is correct.But the result of costom board is wrong.
The wrong data is show as above.
I don't konw the reason.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The error data is our hardware bug.
I fix the hardware bug,and the puart is work fine.
Thanks for your help.