time-nuts@lists.febo.com

Discussion of precise time and frequency measurement

View all threads

GPScon running on Raspberry Pi 3b

MS
Mark Sims
Fri, Jun 23, 2017 12:36 AM

Heather only requires TXD, RXD, and GND.  If you want to use the temperature control feature RTS and DTR.

Most Linux distros have decent USB serial port drivers built in.  I tend to use no-name Chinese PL-2303 based USB dongles... because I have them.  They have worked fine on all the Linuxy stuff I have used and the Windows drivers they shipped with work.

I no longer use FTDI based devices since there are LOTS of clone chips out there and FTDI is rather aggressive about having their (Windows) drivers not work with them.  Since there is no way to tell what chip is actually being used in a dongle, I just avoid the FTDI stuff and any potential hassles.  There are also fake Prolific chips out there and Prolific has also been known to block their Windows drivers from working with them.  If you can find genuine FTDI / Prolific chip based dongles, they are great... but buyer beware these days.

I also have some CH3xx dongles that have some clone chips in them.  Many Linux drivers don't seem to be able to set the baud rate on those.

Something recently changed on one of my Win XP boxes (perhaps installing the TL-833 prom burner software) and some of my PL-2303 dongles have started acting up.  After a day or two of continuous operation they start randomly dropping received bytes.  No issues running the same dongles on PI / Linux / macOS or previously on that XP system.

The garbaged received data did help my find a bug in Heather...  they could produce numbers like 1.2345E300.  Heather was expecting a number like 9.8765 and tried to format and print the value.  The resulting 300 character string overflowed a buffer and crashed the program.  Now my number reader routines do a sanity check and reject obviously bogus values, NANs, INFs, etc.

The PI does have a couple of logic level serial ports on the expansion connector you can connect a level shifter two.  One port is normally the Linux serial console which you can configure to be a general purpose serial port (I've never used them, but others have).


Are there any special requirements for using a USB to RS-232 adapter on the

Pi? Any specific features for the RS-232 adapter to get all of the features
for Lady Heather?

Heather only requires TXD, RXD, and GND. If you want to use the temperature control feature RTS and DTR. Most Linux distros have decent USB serial port drivers built in. I tend to use no-name Chinese PL-2303 based USB dongles... because I have them. They have worked fine on all the Linuxy stuff I have used and the Windows drivers they shipped with work. I no longer use FTDI based devices since there are LOTS of clone chips out there and FTDI is rather aggressive about having their (Windows) drivers not work with them. Since there is no way to tell what chip is actually being used in a dongle, I just avoid the FTDI stuff and any potential hassles. There are also fake Prolific chips out there and Prolific has also been known to block their Windows drivers from working with them. If you can find genuine FTDI / Prolific chip based dongles, they are great... but buyer beware these days. I also have some CH3xx dongles that have some clone chips in them. Many Linux drivers don't seem to be able to set the baud rate on those. Something recently changed on one of my Win XP boxes (perhaps installing the TL-833 prom burner software) and some of my PL-2303 dongles have started acting up. After a day or two of continuous operation they start randomly dropping received bytes. No issues running the same dongles on PI / Linux / macOS or previously on that XP system. The garbaged received data did help my find a bug in Heather... they could produce numbers like 1.2345E300. Heather was expecting a number like 9.8765 and tried to format and print the value. The resulting 300 character string overflowed a buffer and crashed the program. Now my number reader routines do a sanity check and reject obviously bogus values, NANs, INFs, etc. The PI does have a couple of logic level serial ports on the expansion connector you can connect a level shifter two. One port is normally the Linux serial console which you can configure to be a general purpose serial port (I've never used them, but others have). ------------------- > Are there any special requirements for using a USB to RS-232 adapter on the Pi? Any specific features for the RS-232 adapter to get all of the features for Lady Heather?
OE
Orin Eman
Fri, Jun 23, 2017 2:51 AM

On Thu, Jun 22, 2017 at 5:36 PM, Mark Sims holrum@hotmail.com wrote:

The PI does have a couple of logic level serial ports on the expansion
connector you can connect a level shifter two.  One port is normally the
Linux serial console which you can configure to be a general purpose serial
port (I've never used them, but others have).

Oh, that's fun on the Pi, especially the Pi3.  Here are my notes on the Pi3
from a different project.  If you're really lucky, they didn't change it
again.

QUOTE:

Well, they just couldn't make it backward compatible out of the box...

By default, ttyAMA0 is used for Bluetooth so there are more hoops to jump
through to wrest it away from the OS's grasp.  ttyS0 is now wired to the IO
pins which we could use if it worked correctly, but apparently its baud
rate depends on the cpu core frequency which is variable*.  Fortunately
there is a way of routing ttyAMA0 to the IO pins

As before, all references to ttyAMA0 need removing from /boot/cmdline.txt.

To disable bluetooth:

systemctl disable hciuart
Add "dtoverlay=pi3-disable-bt" to /boot/config.txt

Finally, perhaps unnecessary, use raspi-config to disable login on the
serial port.  (Serial under Advanced Options.)

On Thu, Jun 22, 2017 at 5:36 PM, Mark Sims <holrum@hotmail.com> wrote: > > The PI does have a couple of logic level serial ports on the expansion > connector you can connect a level shifter two. One port is normally the > Linux serial console which you can configure to be a general purpose serial > port (I've never used them, but others have). > Oh, that's fun on the Pi, especially the Pi3. Here are my notes on the Pi3 from a different project. If you're really lucky, they didn't change it again. QUOTE: Well, they just couldn't make it backward compatible out of the box... By default, ttyAMA0 is used for Bluetooth so there are more hoops to jump through to wrest it away from the OS's grasp. ttyS0 is now wired to the IO pins which we could use if it worked correctly, but apparently its baud rate depends on the cpu core frequency which is _variable_*. Fortunately there is a way of routing ttyAMA0 to the IO pins As before, all references to ttyAMA0 need removing from /boot/cmdline.txt. To disable bluetooth: systemctl disable hciuart Add "dtoverlay=pi3-disable-bt" to /boot/config.txt Finally, perhaps unnecessary, use raspi-config to disable login on the serial port. (Serial under Advanced Options.) * https://frillip.com/raspberry-pi-3-uart-baud-rate-workaround/ https://www.raspberrypi.org/forums/viewtopic.php?f=107&t=138223
CA
Chris Albertson
Fri, Jun 23, 2017 5:02 AM

I've got a Pi3 here on my desk.  I only see one UART that connects to GPIO
pins.  But it turns out if you actually need to use serial you use the USB
to serial dongles.  If you need four serial ports use four dongles.  That
is just the way the Pi3 is.

You can level the 3.3 volt serial port but then you are into a MAX chip and
some passives or maybe just a couple transistors but the =USB-Serial dingle
is easier then level shifting.

If you want a Pi-like device that is better for real-time embedded use look
at the Beagle Bone Black.  But it was limited CPU and RAM compared to Pi3
but better IO.

If you are building a NTP server, look at the Pi Zero version 1.3.  $5 each.

On Thu, Jun 22, 2017 at 7:51 PM, Orin Eman orin.eman@gmail.com wrote:

On Thu, Jun 22, 2017 at 5:36 PM, Mark Sims holrum@hotmail.com wrote:

The PI does have a couple of logic level serial ports on the expansion
connector you can connect a level shifter two.  One port is normally the
Linux serial console which you can configure to be a general purpose

--

Chris Albertson
Redondo Beach, California

I've got a Pi3 here on my desk. I only see one UART that connects to GPIO pins. But it turns out if you actually need to use serial you use the USB to serial dongles. If you need four serial ports use four dongles. That is just the way the Pi3 is. You can level the 3.3 volt serial port but then you are into a MAX chip and some passives or maybe just a couple transistors but the =USB-Serial dingle is easier then level shifting. If you want a Pi-like device that is better for real-time embedded use look at the Beagle Bone Black. But it was limited CPU and RAM compared to Pi3 but better IO. If you are building a NTP server, look at the Pi Zero version 1.3. $5 each. On Thu, Jun 22, 2017 at 7:51 PM, Orin Eman <orin.eman@gmail.com> wrote: > On Thu, Jun 22, 2017 at 5:36 PM, Mark Sims <holrum@hotmail.com> wrote: > > > > > The PI does have a couple of logic level serial ports on the expansion > > connector you can connect a level shifter two. One port is normally the > > Linux serial console which you can configure to be a general purpose -- Chris Albertson Redondo Beach, California
T
timenut@metachaos.net
Sun, Jun 25, 2017 3:08 PM

Mark,

I compiled and ran Lady Heather on my Tinker this morning. This is using the
"stretch" distribution with GCC version 6.3.0 (and of course, the current
version is 7.1.0 with more language changes). I received 8 warning messages,
the first three are a language change and remainder are "misleading
indentation" messages. To get a clean compile, I fixed the spaces and
indentation, but looking at the code it is the type of thing that I would
check to make sure that the control flow is correct - the indentation is
indeed misleading which is always a potential sign of a bug. Here are the
warning messages that I got:

heather.cpp:13720:10: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
heather.cpp:13720:27: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
heather.cpp:13720:40: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix]
heather.cpp:10881:26: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
heather.cpp:10883:4: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
heathmsc.cpp:2124:28: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
heathmsc.cpp:6710:24: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
heathgps.cpp:20433:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]

Also, I am waiting for my USB to RS232 adapter, so I don't have anything
plugged into the USB ports (other than keyboard and mouse). When I ran it with
./heather -4u, it first told me that it was unable to open /dev/ttyUSB0 and
then told me it was unable to open /dev/ttyUSB3. This is probably due to the
configuration file containing "-1u", but if that option is given on the
command line then the configuration file value should be ignored - or at the
least it should be tried after the command line option.

Other than the above, it looks great given that nothing is plugged in!

Thanks for the work you do maintaining this program.

Michael

Mark, I compiled and ran Lady Heather on my Tinker this morning. This is using the "stretch" distribution with GCC version 6.3.0 (and of course, the current version is 7.1.0 with more language changes). I received 8 warning messages, the first three are a language change and remainder are "misleading indentation" messages. To get a clean compile, I fixed the spaces and indentation, but looking at the code it is the type of thing that I would check to make sure that the control flow is correct - the indentation is indeed misleading which is always a potential sign of a bug. Here are the warning messages that I got: heather.cpp:13720:10: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix] heather.cpp:13720:27: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix] heather.cpp:13720:40: warning: invalid suffix on literal; C++11 requires a space between literal and string macro [-Wliteral-suffix] heather.cpp:10881:26: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation] heather.cpp:10883:4: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation] heathmsc.cpp:2124:28: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation] heathmsc.cpp:6710:24: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation] heathgps.cpp:20433:7: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation] Also, I am waiting for my USB to RS232 adapter, so I don't have anything plugged into the USB ports (other than keyboard and mouse). When I ran it with ./heather -4u, it first told me that it was unable to open /dev/ttyUSB0 and then told me it was unable to open /dev/ttyUSB3. This is probably due to the configuration file containing "-1u", but if that option is given on the command line then the configuration file value should be ignored - or at the least it should be tried after the command line option. Other than the above, it looks great given that nothing is plugged in! Thanks for the work you do maintaining this program. Michael
AG
Adrian Godwin
Sun, Jun 25, 2017 11:02 PM

On Fri, Jun 23, 2017 at 1:36 AM, Mark Sims holrum@hotmail.com wrote:

I also have some CH3xx dongles that have some clone chips in them.  Many
Linux drivers don't seem to be able to set the baud rate on those.

I looked into this when I was struggling with a CH3xx interface recently.
It appears to be OK if you have a 4.0 or higher kernel. Unfortunately this
doesn't include what was until recently the current Debian distribution,
jessie. However, the version released a few days ago (stretch) should be OK.

On Fri, Jun 23, 2017 at 1:36 AM, Mark Sims <holrum@hotmail.com> wrote: > > I also have some CH3xx dongles that have some clone chips in them. Many > Linux drivers don't seem to be able to set the baud rate on those. > > I looked into this when I was struggling with a CH3xx interface recently. It appears to be OK if you have a 4.0 or higher kernel. Unfortunately this doesn't include what was until recently the current Debian distribution, jessie. However, the version released a few days ago (stretch) should be OK.