Skip to content

SerialPIO with baudrate 19200 receives incorrect data #2928

Closed
@GHswitt

Description

@GHswitt

Hi all,

I'm trying to get SerialPIO working with a Pico. After receiving incomplete data and disabling/removing more and more code I'm down to this test program:

#include <SerialPIO.h>

SerialPIO ser3(-1,15,32);

void setup() {
  Serial.begin(115200);
  ser3.begin(19200);
}

void loop() {
  if (ser3.available()) {
    Serial.write(ser3.read());
  }
}
  • If I'm using a hardware serial (Serial2 etc.), I get the correct data.
  • Checked the signal with a scope, it is good.
  • Tried different IOs for RX: 3, 5, 7, 11
  • Tried different FIFO sizes

I also tried changing the system clock from 200 MHz to 120 MHz or 240 MHz since because of this code:

pio_sm_put_blocking(_rxPIO, _rxSM, clock_get_hz(clk_sys) / (_baud * 2) - 7 /* insns in PIO halfbit loop */);

clock_get_hz(clk_sys) / (_baud * 2) - 7

With 120 MHz and 19200 it gets a nice round number of 3118.

It is not that it never matches the data but is about 50% errors or more, for example:

MON	�������������
H1	-89268
H2	-�����������������C!�S�jRB�%�������5)!�%���ip���p�jljrr���r�9579
H10	7
H11�������������������LS�jRB��%����5)!��%���������������B
PID	0xC038
V	53065
I	-5150
P	-27�����������������BN�SH�Eu�4���jR

Normally everything is ASCII, tabs and newlines.

I would be happy for every idea what I could check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions