Go Down

Topic: Troubles on serial port with Uno wifi rev2 (Read 269 times) previous topic - next topic

godzila

Hi everyone,

So I am trying to use the arduino uno wifi rev2 with the fingerprint : GT-521F32.

As i am well educated  :smiley-fat: I followed step by step the sparkfun hook-up guide. And well the exemple "blink" they're giving doesn't work on the uno wifi rev2.

As there is a little bit of electronics I double triple checked my wiring but i didn't spot any problems. So i figured it came from the code or the board.

Having the arduino uno in stock i decided to try the code on the uno and bingo it works perfectly, nothing to change in the code it works perfectly.

when I open arduino's serial monitor here's what it says with the arduino Uno wifi rev 2:

5jz⸮⸮⸮5
FPS - SEND: "55 AA 01 00 00 00 00 00 01 00 01 01"


and with the Uno standard :

FPS - Open
FPS - SEND: "55 AA 01 00 00 00 00 00 01 00 01 01"
FPS - RECV: "55 AA 01 00 00 00 00 00 30 00 30 01"


There is also a bunch of warnings that appears with the wifi rev2 ... I tried changing pins as suggested in the exemple but it doesn't change anything.

The wifi rev 2 works everywhere else it gets info analog input, can light a LED.

Any help or if you want more info don't hesitate !

here's the exemple code :
https://github.com/sparkfun/Fingerprint_Scanner-TTL/blob/master/examples/FPS_Blink/FPS_Blink.ino

godzila

I tried simple serial communication but still weird stuff happens. here's my code :

void setup(){

     Serial.begin(9600);
     Serial.println("hello world");
}

void loop() {
}

so when I open my serial monitor(the one of arduino IDE) and i click the reset button of the arduino I should see hello world (and it is what happens with my UNO) but with the wifi rev2 it writes "????? world" and it fails to rewrite hello world. I am at 9600 bauds every where.

Thanks in advance

pert

You can fix the issue by adding a short delay before the print:
Code: [Select]
void setup() {
  Serial.begin(9600);
  delayMicroseconds(100);
  Serial.println("hello world");
}

void loop() {
}


I'm having some trouble reading the schematic, but it does appear that the ATmega32U4 chip used for a USB to TTL serial adapter to the ATmega4809 is also reset. I wonder if there is some issue with that chip stabilizing before it starts receiving serial data from the ATmega4809?

westfw

I would say that it is "somewhat likely" that SoftwareSerial doesn't work on the WiFi2, since it has different timers (and other peripherals) than the Uno/etc.

On the other hand, WiFi2 has 4 UARTs, and I'd think you could connect the sensor to pins 0/1, which are "Serial1" on that board ("Serial" connects to the USB/Serial/Debug chip, using SEPARATE PINS from 0/1 !)

godzila

Hi,

Indeed the ATmega32U4 chip needs some time before giving good performance. Now the message is always good.

Now about the fingerprint sensor, I just tried using pin 0 and 1 and removed the SoftwareSerial library. But it still doesn't work.

When I look inside the fingerprintsensor(FPS) library they're calling SoftwareSerial.h. Which if you are right @westfw means that my FPS library can not work with the wifi Rev2. Except if I can manage to delete the reason why there is a need of softwareSerial...
From what I see, I could always call Serial1 instead of their software serial function, because they're only using one serial port.

To be honest i'm not really sure what i am doing but I'll try. Now i've linked the FPS library in question if any one would give it a try..

Thanks guys !


pert

The Arduino megaAVR Boards core does have its own SoftwareSerial library:
https://github.com/arduino/ArduinoCore-megaavr/tree/master/libraries/SoftwareSerial
I just did a quick test with this sketch:
Code: [Select]
#include <SoftwareSerial.h>
SoftwareSerial softSer(10, 11);

void setup() {
  Serial.begin(9600);
  softSer.begin(9600);
  delay(1000);
  Serial.println("Hello World");
  softSer.println("Hello World");
}

void loop() {
  if (softSer.available()) {
    Serial.write(softSer.read());
  }

  if (Serial.available()) {
    softSer.write(Serial.read());
  }
}

What I found is that, consistently, the first thing sent from the software serial port is corrupted. After that it works fine. It seems like maybe there is a bug in the Arduino megaAVR Boards SoftwareSerial library. However, it's not a complete loss. A workaround would be to make a "sacrificial" initial print to the software serial port before any print that is essential. That assumes the corrupted "sacrificial" print will be ignored by your fingerprint reader.

Of course using Serial1 if possible is ideal, since hardware serial is always better that software serial when you have a spare hardware serial port.

Go Up