0

Nrf52 software-serial does not work properly
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Nrf52 software-serial does not work properly

by jps2000 on Tue Feb 05, 2019 8:28 am

@hathach
It seems that in nrf52832 softwareserial does not perform correctly.
There are always many errors in the transmission (read).
I use just this:
while(ss.available()) Serial.write(ss.read()); // to check what is sent

Even in 9600 baud it is not working without errors.

I use a feather nrf52832 board (bootloader 2.6, SW 9.0.3) and tried to read raw data from a GPS receiver.

When I connect a FT232 then everything is fine.

Also in 9.0.1 it is not working.
I used pins A4 and A5 for RX and TX respectively

Any chance to get softwareserial on nrf52 to operation?
Last edited by jps2000 on Fri Feb 08, 2019 3:01 am, edited 1 time in total.

jps2000
 
Posts: 333
Joined: Fri Jun 02, 2017 4:12 pm

Re: Nrf52 software-serial does not work properly

by jps2000 on Thu Feb 07, 2019 8:06 am

push

jps2000
 
Posts: 333
Joined: Fri Jun 02, 2017 4:12 pm

Re: Nrf52 software-serial does not work properly

by jps2000 on Thu Feb 14, 2019 1:20 am

please

jps2000
 
Posts: 333
Joined: Fri Jun 02, 2017 4:12 pm

Re: Nrf52 software-serial does not work properly

by hathach on Thu Feb 14, 2019 6:49 am

Thanks for your patient, I have just came back from Lunar New Year Holiday. Have you tried the gps test example sketch

https://github.com/adafruit/Adafruit_nR ... est_swuart

Last time I tried, it seems to work well. Btw, do you have any other task running e.g i2c, ble in your sketch, if you do please provide your simplest sketch and instruction to reproduce the issue so that we could work and verify the issue is fixed.

hathach
 
Posts: 893
Joined: Tue Apr 23, 2013 1:02 am

Re: Nrf52 software-serial does not work properly

by jps2000 on Thu Feb 14, 2019 7:19 am

Thanks for the response. I thought LNYH might be the reason as I know you for reliable replies.
Yes I am using I2C and BLE.
I now found a GPS module with I2C interface (waiting for boards delayed by LNYH :-) )

In fact I used the same library however on pins A4 and A5.
I2C has rather heavy traffic due to an IMU (BNO080) and a BMP388 talking there
But even without it seemed not to work

jps2000
 
Posts: 333
Joined: Fri Jun 02, 2017 4:12 pm

Re: Nrf52 software-serial does not work properly

by hathach on Thu Feb 14, 2019 11:59 am

I will do more test with ble traffic later. Due to freeRTOS preemption, ble task will be able to preempt the current code when there is ble traffic, it could corrupt the bit banging of soft serial. We need to insert some mutex guard, fyi, soft serial lib is ported from Arduino primo core, which doesn't have freeRTOS

hathach
 
Posts: 893
Joined: Tue Apr 23, 2013 1:02 am

Re: Nrf52 software-serial does not work properly

by jps2000 on Thu Feb 14, 2019 1:58 pm

Thank you
Sounds plausible. Interestingly there are less corrupted letters in the stream at higher baud rates.
So freeRTOS is likely the crux of the issue.

jps2000
 
Posts: 333
Joined: Fri Jun 02, 2017 4:12 pm

Re: Nrf52 software-serial does not work properly

by jps2000 on Sat Mar 16, 2019 3:22 pm

Now I gave it another try
software serial 9600 baud

With calling Bluefruit.Advertising.start(0); I get corrupt data like

$GPRMC,001509.870,V,,,⸮⸮r⸮⸮b⸮r⸮⸮b⸮⸮⸮⸮‚bbbr⸮V*3A
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,001509.870,,,,,0,0,,,M,,M,,*4A
$GPGSA,A,1,,,,,,,,,,,,,,,,1*03
$GPGSA,A,1,,⸮⸮bbbbbbbbbbb⸮R⸮⸮j
$GPGSV,1,1,00,0*65
$GLGSV,1,1,00,1*78
$GPGLL,,,,,001509.870,V,N*78

when I comment out Bluefruit.Advertising.start(0); then data are ok:

$GPRMC,000036.868,V,,,,,0.00,0.00,060180,,,N,V*3B
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,000036.868,,,,,0,0,,,M,,M,,*4B
$GPGSA,A,1,,,,,,,,,,,,,,,,1*03
$GPGSA,A,1,,,,,,,,,,,,,,,,2*00
$GPGSV,1,1,00,0*65
$GLGSV,1,1,00,1*78
$GPGLL,,,,,000036.868,V,N*79

So bit banging of soft serial fails in case of BLE traffic

@hathach ---> We need to insert some mutex guard,

please

jps2000
 
Posts: 333
Joined: Fri Jun 02, 2017 4:12 pm

Re: Nrf52 software-serial does not work properly

by XRAD on Sun Mar 17, 2019 11:20 am

did you try softwareSerial at 38400 b ?

have you tried AltSoftSerial?

XRAD
 
Posts: 209
Joined: Sat Nov 19, 2016 3:28 pm

Re: Nrf52 software-serial does not work properly

by jps2000 on Sun Mar 17, 2019 12:55 pm

not yet
But I do not expect an improvement although I know that faster transmission reduces the probability of errors.
This is a fundamental problem to be solved by experts

jps2000
 
Posts: 333
Joined: Fri Jun 02, 2017 4:12 pm

Please be positive and constructive with your questions and comments.