HW UART for GPS logging with TinyZero

WillemH

  • Full Member
  • ***
    • Posts: 14
    • View Profile
I have implemented logging of GPS NMEA strings on microSD using SW UART in the communication between the GPS (u-blox SAM-M8Q GPS on the Sparkfun GPS 15210 board) and a TinyZero with additional shields, see also post “TinyShield does not provide actual altitude” on this forum. This works fine for the GGA, GSA and VTG strings at 5 Hz.

The SW UART is using the “SoftwareSerialZero” set of routines. This works, but the highest working baud rate  that can be reached in this application is 19200.

I would like to use a higher baud rate, e.g. 38400, because currently the communication from GPS to TinyZero takes much more time than the communication from TinyZero to microSD. The latter is done in very efficient blocks of 512 bytes.

It has been tested that the GPS can work on this higher baud rate of 38400 with the same NMEA strings using the u-blox programme u-center on PC with windows 10 using a USB to UART Bridge.

I have tried to implement the HW UART using IO0 as RX (at Processor-side), IO1 as TX and GND. RX connected to TX at GPS-side and TX to RX at GPS-side. Furthermore I have defined the serial as “Serial1”, because that would be logical for Arduino Zero derivatives. This does not give any errors during compilation, so "Serial1" is recognized, but it is not working even at a baud rate of 9600. No character is received.

What is wrong?

Are the “Serial1” related pins located elsewhere in case of TinyZero?

It would also be logical that additional definitions or routines are necessary, but up to now I could not find anything. What is missing?

Please help.


Ben Rose

  • Administrator
  • Hero Member
  • *****
    • Posts: 346
    • View Profile
Hi Willem- Sorry, there's probably a lack of documentation on this for TinyZero. Hardware serial on pins 0/1 on our boards should be 'Serial', we use 'SerialUSB' for the virtual serial over USB. I think some Arduino Zero derivatives use 'Serial' for the virtual and 'Serial1' as the primary hardware port, so it gets confusing. Let me know if this is working properly. RX on IO0, TX on IO1 is correct from the processor point of view.

Sorry about the poor response on your other post, I think Laveréna was waiting on some input from me and it got lost in my inbox.

Thanks for your patience,
Ben


WillemH

  • Full Member
  • ***
    • Posts: 14
    • View Profile
Hi Ben,

many thanks for your fast and very helpful response.

I clearly overlooked 'Serial', because I thought it only related to the serial monitor for the Tinyduino.
In the mean time I have done quick tests with HW UART with baud rates of both 19200 and 38400 in my high load GPS logging application.
Conclusion: 'Serial' works fine and a higher baud rate is possible than with 'SoftwareSerialZero'.

So, many thanks again.

Willem


Perhaps a directly related question, because the potential use of a USB Tiny Shield in case of a TinyZero processor is not completely clear for me:

Is it possible to use an additional bus-connected USB Tiny Shield as 'USB to UART Bridge' between PC and GPS for such  a GPS UART channel pinning (IO0 as RX (at Processor-side), IO1 as TX ) in case  a  non-interfering code is running on the TinyZero (e.g. Blink)?  I also assume that the TinyZero USB connection is not used at the same time.
Such a temporary PC-GPS connection is very useful e.g. to check and reconfigure a u-blox GPS with the programme u-center.

Or do I overlook some unwanted effects?


Ben Rose

  • Administrator
  • Hero Member
  • *****
    • Posts: 346
    • View Profile
Hi Willem,

Great, glad the hardware serial is working.

Regarding the USB TinyShield, it doesn't work directly in that application because the TX/RX are the same as the GPS and not inverted as when compared to the processor board. Wiring it in for that application is probably too much effort. However software on the TinyZero can easily implement a low throughput 'adapter' from hardware to virtual serial in the main loop- look up the "SerialPassthrough" example to get an idea of how to do so.

Thanks,
Ben


WillemH

  • Full Member
  • ***
    • Posts: 14
    • View Profile
Hi Ben,

many thanks.

You are right, crossing Tx and Rx is also necessary for the use as 'USB to UART Bridge'.

I think I will go for a HW solution: an additional temporary cross in the wiring, because the connection to the external GPS units I currently use is through a protoboard with wiring to connectors.

Many thanks again,

Willem


 

SMF spam blocked by CleanTalk