Replies: 14 comments 15 replies
-
There is no SWSerial for this core now, but PRs are always appreciated. If there is a non-HW specific SWSerial library available, in theory it should work here. But something like the SWSerial used on the AVRs or the Espressif chips will not work here, of course. I'm messing around with a PIO-based |
Beta Was this translation helpful? Give feedback.
-
Thank You!
Transmission works fine, but somehow I receive garbage (1200, 9600 Bd).
Happy New Year!
------ Originalnachricht ------
Von: "Earle F. Philhower, III" ***@***.***>
An: "earlephilhower/arduino-pico" ***@***.***>
Cc: "hgs12345" ***@***.***>; "Author"
***@***.***>
Gesendet: 27.12.2021 20:03:24
Betreff: Re: [earlephilhower/arduino-pico] SoftwareSerial (Discussion
#360)
See PR #391 <#391>
which implements SW Serial ports using the PIO blocks.
—
Reply to this email directly, view it on GitHub
<#360 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKZS34SMUE7OJBIPI4AU7WDUTCZ7ZANCNFSM5JHBENQQ>.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
… |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer!
Please have a look on my test-program!
I have a second question: how is it possible to increase internal serial
buffer size? I did not manage to change SERIAL_TX_BUFFER_SIZE or
SERIAL_RX_BUFFER_SIZE to 512.
This would allow a longer "TestString" (TestString1 --> TestString4) in
my program.
Best regards from Vienna!
------ Originalnachricht ------
Von: "Earle F. Philhower, III" ***@***.***>
An: "earlephilhower/arduino-pico" ***@***.***>
Cc: "hgs12345" ***@***.***>; "Author"
***@***.***>
Gesendet: 31.12.2021 18:08:43
Betreff: Re: [earlephilhower/arduino-pico] SoftwareSerial (Discussion
#360)
Can you make a loopback test that fails? My own tests, sending from
Serial1 to a PIOSerial at 115200 and 1200 bps work fine:
// Connect GP0 to GP17
SerialPIO s(16, 17);
void setup() {
Serial.begin();
Serial1.begin(1200);
s.begin(1200, SERIAL_8N1);
delay(5000);
}
void loop() {
for (char x = 'a'; x <= 'z'; x++ ) {
Serial.printf("Sending '%c' (%d) on the PIO TX\n", x, x);
Serial1.write(x);
Serial1.write(x+1);
delay(1000);
Serial.printf("PIORX available: %d\n", s.available());
while (s.available()) {
int xa = s.read();
Serial.printf("PIORX received '%c' (%d)\n", xa, xa);
}
delay(1000);
}
}
gives the expected output
09:06:03.508 -> Sending 'a' (97) on the PIO TX
09:06:04.534 -> PIORX available: 2
09:06:04.534 -> PIORX received 'a' (97)
09:06:04.534 -> PIORX received 'b' (98)
09:06:05.527 -> Sending 'b' (98) on the PIO TX
09:06:06.519 -> PIORX available: 2
09:06:06.519 -> PIORX received 'b' (98)
09:06:06.519 -> PIORX received 'c' (99)
09:06:07.512 -> Sending 'c' (99) on the PIO TX
09:06:08.538 -> PIORX available: 2
09:06:08.538 -> PIORX received 'c' (99)
09:06:08.538 -> PIORX received 'd' (100)
09:06:09.531 -> Sending 'd' (100) on the PIO TX
09:06:10.523 -> PIORX available: 2
09:06:10.523 -> PIORX received 'd' (100)
09:06:10.523 -> PIORX received 'e' (101)
...
—
Reply to this email directly, view it on GitHub
<#360 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKZS34SBZU3U5V3R3LRR6ULUTXPRXANCNFSM5JHBENQQ>.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
… |
Beta Was this translation helpful? Give feedback.
-
// You can change the pin numbers to match your wiring:
int tx_pin=13;
int rx_pin=15;
char SeriellerEmpfangString1[300] = "", SeriellerEmpfangString2[300] =
"", SeriellerEmpfangString3[300] = "";
char SeriellerEmpfangString_aktuell1[300] = "",
SeriellerEmpfangString_aktuell2[300] = "",
SeriellerEmpfangString_aktuell3[300] = "";
int EmpfangStringIndex1 = 0, EmpfangStringIndex2 = 0,
EmpfangStringIndex3 = 0, EmpfangFlag1 = 2, EmpfangFlag2 = 0,
EmpfangFlag3 = 0;
char TestString1[] = "[+0.010 +0.015 -0.020 +0.025]\n";
char TestString2[] = "[[+0.010 +0.015 -0.020 +0.025][-0.030 -0.035
0.040 +0.045]]\n";
char TestString3[] = "[[[+0.010 +0.015 -0.020 +0.025][-0.030 -0.035
0.040 +0.045]][[-0.050 -0.055 -0.060 -0.065][-0.070 +0.075 0.080
-0.085]]]\n";
char TestString4[] = "[[[[+0.010 +0.015 -0.020 +0.025][-0.030 -0.035
0.040 +0.045]][[-0.050 -0.055 -0.060 -0.065][-0.070 +0.075 0.080
-0.085]]][[[ 0.090 -0.095 0.100 +0.105][-0.110 +0.115 -0.120
+0.125]][[-0.130 -0.135 0.140 -0.145][-0.150 -0.155 -0.160
-0.165]]]]\n";
SerialPIO Serial3(tx_pin, rx_pin);
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
Serial1.begin(19200);
Serial2.begin(19200);
Serial3.begin(19200);
delay(2000);
}
void loop()
{
unsigned long currentMillis = millis();
static unsigned long previousMillis;
// here we look if characters came in and we put them in a buffer
("SeriellerEmpfangString")
// if it is a "LineFeed" content of "SeriellerEmpfangString" is copied
to an other buffer "SeriellerEmpfangString_aktuell" and "EmpfangFlag" is
set
while (Serial1.available()) // empfängt von GP1
{
unsigned char inByte = Serial1.read();
if (inByte == '\n')
{
SeriellerEmpfangString1[EmpfangStringIndex1] = 0;
EmpfangStringIndex1 = 0;
strcpy(SeriellerEmpfangString_aktuell1, SeriellerEmpfangString1);
EmpfangFlag1 = 1;
}
else
{
SeriellerEmpfangString1[EmpfangStringIndex1] = inByte;
if (EmpfangStringIndex1 < 290) ++EmpfangStringIndex1;
SeriellerEmpfangString1[EmpfangStringIndex1] = 0;
}
}
while (Serial2.available()) // empfängt von GP9
{
int inByte = Serial2.read();
if (inByte == '\n')
{
SeriellerEmpfangString2[EmpfangStringIndex2] = 0;
EmpfangStringIndex2 = 0;
strcpy(SeriellerEmpfangString_aktuell2, SeriellerEmpfangString2);
EmpfangFlag2 = 1;
}
else
{
SeriellerEmpfangString2[EmpfangStringIndex2] = inByte;
if (EmpfangStringIndex2 < 290) ++EmpfangStringIndex2;
SeriellerEmpfangString2[EmpfangStringIndex2] = 0;
}
}
while (Serial3.available()) // empfängt von GP15
{
int inByte = Serial3.read();
if (inByte == '\n')
{
SeriellerEmpfangString3[EmpfangStringIndex3] = 0;
EmpfangStringIndex3 = 0;
strcpy(SeriellerEmpfangString_aktuell3, SeriellerEmpfangString3);
EmpfangFlag3 = 1;
}
else
{
SeriellerEmpfangString3[EmpfangStringIndex3] = inByte;
if (EmpfangStringIndex3 < 290) ++EmpfangStringIndex3;
SeriellerEmpfangString3[EmpfangStringIndex3] = 0;
}
}
// now we look, if there is a complete string ready
if (EmpfangFlag1 == 1)
{
Serial.println(SeriellerEmpfangString_aktuell1);
EmpfangFlag1 = 0;
}
if (EmpfangFlag2 == 1)
{
Serial.println(SeriellerEmpfangString_aktuell2);
EmpfangFlag2 = 0;
}
if (EmpfangFlag3 == 1)
{
Serial.println(SeriellerEmpfangString_aktuell3);
EmpfangFlag3 = 0;
}
// every 2 seconds a TestString is sent out
// everything is fine for transmission from Serial1 to Serial2
// from Serial2 to Serial1
// from Serial3 to Serial1
// from Serial3 to Serial2
// from Serial3 to Serial3
// but there is a problem from Serial1 to Serial3 or
Serial2 to Serial3
currentMillis = millis();
if (currentMillis - previousMillis >= 2000L)
{
previousMillis = currentMillis;
Serial3.print(TestString1); // NO problem for transmission
from Serial1, Serial2 or Serial3
}
// there is a workaround: put a delay(5) after transmission of each
character
// but this decreases transmission speed!
/*
currentMillis = millis();
if (currentMillis - previousMillis >= 2000L)
{
previousMillis = currentMillis;
for (int i=0; i<strlen(TestString1); ++i)
{
Serial1.print(TestString1[i]);
delay(5); // reception on Serial3 is OK
}
}
*/
}
------ Originalnachricht ------
Von: "Earle F. Philhower, III" ***@***.***>
An: "earlephilhower/arduino-pico" ***@***.***>
Cc: "hgs12345" ***@***.***>; "Author"
***@***.***>
Gesendet: 02.01.2022 13:23:20
Betreff: Re: [earlephilhower/arduino-pico] SoftwareSerial (Discussion
#360)
The test program did not make it to GitHub. Maybe it was an attachment
that was not accepted by GH. Copy/pasting into the main body would work
better in that case...
—
Reply to this email directly, view it on GitHub
<#360 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKZS34RSCED5AIOLWONGJQDUUA7TRANCNFSM5JHBENQQ>.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
… |
Beta Was this translation helpful? Give feedback.
-
I replaced "SerialUART.cpp" and "SerialPIO.cpp" and now it work!
Thank You!
Please don't forget: configurable FIFO sizes
------ Originalnachricht ------
Von: "Earle F. Philhower, III" ***@***.***>
An: "earlephilhower/arduino-pico" ***@***.***>
Cc: "hgs12345" ***@***.***>; "Author"
***@***.***>
Gesendet: 02.01.2022 14:48:54
Betreff: Re: [earlephilhower/arduino-pico] SoftwareSerial (Discussion
#360)
I found a couple things with the code. There was a hang on overflow and
the PIO UART was sometimes missing a start bit when the HW serial port
sent it. I've committed a fix #401
<#401> for both, can
you give that a try?
As for configurable FIFO sizes, that's a simple addition once the logic
bugs are cleared up.
—
Reply to this email directly, view it on GitHub
<#360 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKZS34WV3FBDMOUJGLYCXP3UUBJUNANCNFSM5JHBENQQ>.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
… |
Beta Was this translation helpful? Give feedback.
-
SerialPIO and configuration of FIFO size works really fine now!
One last question (at least I hope so): how is it possible to configure
FIFO size for hardware Serial1 and Serial2 ?
Thank You!
>Message ID:
***@***.***>
…>
|
Beta Was this translation helpful? Give feedback.
-
Thank You!
Perfect !
------ Originalnachricht ------
Von: "Earle F. Philhower, III" ***@***.***>
An: "earlephilhower/arduino-pico" ***@***.***>
Cc: "hgs12345" ***@***.***>; "Author"
***@***.***>
Gesendet: 04.01.2022 00:56:12
Betreff: Re: [earlephilhower/arduino-pico] SoftwareSerial (Discussion
#360)
Not now. You can edit the SerialUART.h file and change _queue[32] to
_queue[256] or whatever and it will automatically work. I'm not sure of
a good way to allow specifying those sizes because they are
instantiated in core code, not user apps. And they're constructed at
boot time.
Adding a Serial1/2.setFIFOSize(xxx) call would be possible, requiring
it to be called before the Serial1/2.begin(), I suppose.
—
Reply to this email directly, view it on GitHub
<#360 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKZS34TQWG7E3YSRRRZITMDUUIZRZANCNFSM5JHBENQQ>.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
… |
Beta Was this translation helpful? Give feedback.
-
Serial1.setFIFOSize(512); |
Beta Was this translation helpful? Give feedback.
-
Hello,
In my application I no longer use SerialPIO because it is no longer
necessary for me to use more than 2 serial ports.
But I can confirm that SerialPIO originally worked with no problems.
Because of your question, I tried a test program again and I found
problems too!
The test program periodically sends out a TestString to Serial1, Serial2
and Serial3 and also receives it from Serial1, Serial2 and Serial3.
It's strange, sometimes the TestStrings are transmitted without errors,
but in rare cases there are transmission errors when receiving on
Serial3 when the TestString is sent from Serial1 or Serial2.
In summary, I believe that SerialPIO is not 100% reliable!
------ Originalnachricht ------
Von: "ksk1536" ***@***.***>
An: "earlephilhower/arduino-pico" ***@***.***>
Cc: "hgs12345" ***@***.***>; "Author"
***@***.***>
Gesendet: 20.04.2022 03:44:33
Betreff: Re: [earlephilhower/arduino-pico] SoftwareSerial (Discussion
#360)
hello
I download board manager version 1.13.2 and
use SerialPIO like example code to receive GPS.
baudrate is 9600 and 8N1
but when I get GPS the data is broken.
10:38:53.039 ->
$GPRMC,013853.00,A,3249.14760,N,12138.90799,E,0.262,,⸮⸮⸮⸮⸮⸮⸮⸮⸮P⸮�TH⸮⸮
10:38:53.133 ->
eEu⸮b⸮⸮⸮5⸮⸮⸮⸮⸮ɱ9⸮⸮⸮⸮⸮ձ-⸮�⸮⸮5)⸮�A���⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮⸮,N,12138.90799,E,1,07,1.04,127.9,M,23.1,M,,5E
10:38:53.224 ->
$GPGSPKPK&)⸮b⸮⸮b⸮⸮b⸮⸮b⸮⸮b⸮⸮b⸮⸮bbbbbb⸮rʊb⸮r⸮⸮b⸮r⸮⸮R⸮⸮jR":A�MY⸮ͱű⸮⸮⸮⸮ѱ⸮⸮⸮⸮ձ⸮ٱ⸮ݱ⸮⸮⸮⸮ѱ⸮⸮⸮⸮⸮⸮ձ⸮⸮ݱ⸮⸮⸮⸮,29,286,2371
10:38:53.363 ->
$GPGSV,3,2,10,16,60,029,36,18,17,047,2⸮⸮⸮LKL�)�bb⸮⸮b⸮⸮b⸮⸮⸮b⸮⸮R⸮25)⸮�A�MY⸮ͱͱ⸮⸮⸮⸮ݱ⸮ѱ⸮⸮ᱱ⸮ű⸮ݱ⸮⸮ձ⸮٩⸮�5)⸮�A�11⸮⸮⸮49.14760,N,12138.90799,E,013853.00,A,A*64
How can I use SerialPIO correctly?
Is there any include headfiles to use SerialPIO ?
—
Reply to this email directly, view it on GitHub
<#360 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKZS34TVLEPDDNTZX6VMA43VF5OQDANCNFSM5JHBENQQ>.
You are receiving this because you authored the thread.Message ID:
***@***.***>
… |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm afraid it's not solved yet!
TestString sent from GP1 (Serial1) to GP15 (Serial3).
57200 Baud: --> Screenshot
9200 Baud: no failure
19200 Baud: does not work at all (no input-string, e.g. \n, detected)
1200 Baud: no failure
------ Originalnachricht ------
Von: "Earle F. Philhower, III" ***@***.***>
An: "earlephilhower/arduino-pico" ***@***.***>
Cc: "hgs12345" ***@***.***>; "Mention"
***@***.***>
Gesendet: 22.04.2022 04:43:19
Betreff: Re: [earlephilhower/arduino-pico] SoftwareSerial (Discussion
#360)
#544 <#544> was
tested at 300bps to 2Mbps loopback and should solve your 9600bps
problem.
—
Reply to this email directly, view it on GitHub
<#360 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKZS34WFE7O6GMWPLMGIEJ3VGIG4PANCNFSM5JHBENQQ>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
… |
Beta Was this translation helpful? Give feedback.
-
Sorry, of course I used 57600 Bd.
Perhaps it is necessary to use different (optimized) parameters for
diffenent baud rates ....
--> decode >>= 33 - _rxBits;
--> pio_sm_put_blocking(_rxPIO, _rxSM, clock_get_hz(clk_sys) /
(_baud * 2) - 5/* insns in PIO halfbit loop */);
My test program waits for '\n`, that's why There is no response at all.
Good luck!
------ Originalnachricht ------
Von: "Earle F. Philhower, III" ***@***.***>
An: "earlephilhower/arduino-pico" ***@***.***>
Cc: "hgs12345" ***@***.***>; "Mention"
***@***.***>
Gesendet: 22.04.2022 16:18:00
Betreff: Re: [earlephilhower/arduino-pico] SoftwareSerial (Discussion
#360)
I think you mean 57600, not 57200, yes? Not receiving anything I find
really hard to believe for 19200 because as long as a 0 is detected on
the line, the PIO program will give something (it may be garbage if the
bit sample times are off, but it will at least return it).
The attachment did not make it through. Can you post it along w/a small
test program so I can run locally. Again, I just ran 57600 and 19200
w/o any trouble using my own loopback test (sending multiple ~15 char
strings w/a wire from Serial1TX/GP0 to SerialPIO RX/GP17).
—
Reply to this email directly, view it on GitHub
<#360 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKZS34RWLLJCG25Y2XDFMODVGKYJRANCNFSM5JHBENQQ>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
… |
Beta Was this translation helpful? Give feedback.
-
Now I use:
decode >>= 33 - _rxBits;
pio_sm_put_blocking(_rxPIO, _rxSM, clock_get_hz(clk_sys) / (_baud * 2) -
5);
In version 1.13.2 (latest version) there was (did not update ??):
decode >>= 32 - _rxBits;
pio_sm_put_blocking(_rxPIO, _rxSM, clock_get_hz(clk_sys) / (_baud * 2) -
2);
I tested 1200Bd, 2400Bd, 4800Bd, 9600Bd, 19200Bd, 38400Bd, 76800Bd,
57600Bd, 115200Bd and 230400Bd and found no failure ! (Serial1
--> Serial3)
Obviously everything is ok now .......
------ Originalnachricht ------
Von: "Earle F. Philhower, III" ***@***.***>
An: "earlephilhower/arduino-pico" ***@***.***>
Cc: "hgs12345" ***@***.***>; "Mention"
***@***.***>
Gesendet: 22.04.2022 17:23:01
Betreff: Re: [earlephilhower/arduino-pico] SoftwareSerial (Discussion
#360)
Can you try the latest Git and change the 33 to a 34 in the line you
listed? I'm thinking I might still have an of-by-one error that's again
timing related...
—
Reply to this email directly, view it on GitHub
<#360 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKZS34W2Q36LHB5ZE2PFMDTVGK75LANCNFSM5JHBENQQ>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
… |
Beta Was this translation helpful? Give feedback.
-
I think everything is working well now, I hope it will run fine in
future too ....
regards .....
------ Originalnachricht ------
Von: "Earle F. Philhower, III" ***@***.***>
An: "earlephilhower/arduino-pico" ***@***.***>
Cc: "hgs12345" ***@***.***>; "Mention"
***@***.***>
Gesendet: 22.04.2022 19:35:32
Betreff: Re: [earlephilhower/arduino-pico] SoftwareSerial (Discussion
#360)
Awesome. Before I do a point release, can you confirm that git master
head is running fine for you? I think that's what you said above, but
want to be sure...
—
Reply to this email directly, view it on GitHub
<#360 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AKZS34VRRO52NOWFKM7AZLTVGLPOJANCNFSM5JHBENQQ>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
… |
Beta Was this translation helpful? Give feedback.
-
hello, ` void setup() { void loop() { Everything works fine when the messages are short. I tried fix #544 but it didn't solve the problem. |
Beta Was this translation helpful? Give feedback.
-
Hi,
cannot find SoftwareSerial ...
I need a third serial connection via ports.
is it planned to be added, and when?
Can somebody help or advise a workaround?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions