Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serial2‘s performance is inconsistent with Serial1 in high baud rate(>=2M) #187

Closed
huangbenlsl opened this issue Jul 21, 2023 · 5 comments

Comments

@huangbenlsl
Copy link

arduino3.1.6
AMB23

Serial2‘s performance is inconsistent with Serial1 in high baud rate(>=2M)。

void threadB(void* pvParameters) {
int recv_length;
uint8_t recv_buff[1024];
for (;;) {
recv_length = Serial2.available();
if(recv_length>0)
{
Serial2.readBytes(recv_buff,recv_length);
if(loss_link_count < 200)
{
client.write(recv_buff,recv_length);
}
Serial.print("uart: ");
Serial.print(recv_length);
Serial.print(" ");
Serial.println(recv_buff[0],HEX);
}
else
{
delay(5);
}
}
}

when packet is larger than 66 bytes,Serial1 can receive complete bytes,but Serial2(LP_UART) can't receive complete bytes。

@huangbenlsl huangbenlsl changed the title Serial Serial2‘s performance is inconsistent with Serial1 in high baud rate(>=2M) Jul 21, 2023
@github-actions
Copy link

Hello, hope this message finds you well. Congrats to your first Issue! We will review it as soon as possiable. Feel free to have a look at https://www.amebaiot.com/en/ameba-arduino-summary/ for more information

@M-ichae-l
Copy link
Collaborator

M-ichae-l commented Jul 24, 2023

@huangbenlsl
hi, we have tested Serial2 with Serial by using FTDI and CP2102 (USB to UART chip), with example demo “MultiSerial“ 2M and 1.5M baud rate.
There is no issue for FTDI but for CP2102 the max baud rate is 1.5M. Therefore, this issue may caused by the USB to UART chip.

@huangbenlsl
Copy link
Author

for test,the length of packet maybe larger than 120 bytes。
what puzzles me the most is WHY SERIAL1 is OKAY in high baud rate(>=2M)。
Do you test serial1 with 2M&CP2102?

@M-ichae-l
Copy link
Collaborator

for test result
serial1 and serial2 can not support 2M with CP2102
serial1 and serial2 can support 2M with FTDI

@huangbenlsl
Copy link
Author

Thanks,usb2ttl module maybe causes this problem,but when connect amb23 with a STM32F405 bord,the problem still exists。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants