Skip to content
Snippets Groups Projects
Commit fbb63d86 authored by Benjamin Koch's avatar Benjamin Koch
Browse files

go back to lower baud rate to avoid overrun

parent f2b404ad
No related branches found
No related tags found
No related merge requests found
...@@ -59,8 +59,8 @@ def main(): ...@@ -59,8 +59,8 @@ def main():
# retry_on_empty=False, # retry_on_empty=False,
# close_comm_on_error=False, # close_comm_on_error=False,
# strict=True, # strict=True,
#baudrate=19200, baudrate=19200,
baudrate=115200*2, #baudrate=115200*2,
parity="E", parity="E",
) )
client.connect() client.connect()
......
...@@ -622,8 +622,8 @@ async fn main2(spawner: Spawner) { ...@@ -622,8 +622,8 @@ async fn main2(spawner: Spawner) {
// use 19200 baud in 8E1 mode - not great but it's the Modbus default // use 19200 baud in 8E1 mode - not great but it's the Modbus default
let mut uart_config = uart::Config::default(); let mut uart_config = uart::Config::default();
//uart_config.baudrate = 19200; uart_config.baudrate = 19200;
uart_config.baudrate = 115200*2; //uart_config.baudrate = 115200*2;
uart_config.parity = Parity::ParityEven; uart_config.parity = Parity::ParityEven;
let rs485 = RS485::new( let rs485 = RS485::new(
p.UART0, rx, tx, tx_en, interrupt::take!(UART0_IRQ), p.DMA_CH1, uart_config, p.UART0, rx, tx, tx_en, interrupt::take!(UART0_IRQ), p.DMA_CH1, uart_config,
......
...@@ -417,6 +417,9 @@ impl<H: RS485Handler> RS485<H> { ...@@ -417,6 +417,9 @@ impl<H: RS485Handler> RS485<H> {
Either4::Fourth(Either3::First(x)) => { Either4::Fourth(Either3::First(x)) => {
drop(rx_future); drop(rx_future);
let rx_char = x.map(|_| -> u8 { rx_buf_one[0] }); let rx_char = x.map(|_| -> u8 { rx_buf_one[0] });
if Err(embassy_rp::uart::Error::Overrun) == x {
// We should probably drain the FIFO but I don't see a good way to do this.
}
rx_future = DontAbort::new(self.rx.read(&mut rx_buf_one), PanicIfReused); rx_future = DontAbort::new(self.rx.read(&mut rx_buf_one), PanicIfReused);
if tx_in_progress { if tx_in_progress {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment