Is anyone using the Raspbery Pi’s hardware serial UART header pins 8 Txd, and 10 Rxd? I am trying to get them to work and am having a very rough time at it.
I can use a USB-2-Serial adapter without any problem. But I really want to use the On Board UART and get rid of the cable.
Any suggestions would be appreciated!
Tim the inbuilt serial port is (on Rasbian if thats your OS) defaulted to be dedicated to the system debug output, i.e. it sends data about the boot up procedure and other data while booting up.
you need to modify settings to stop it doing that and explicitly take control of the port.
even then you must be VERY cautious about using the port, it is directly connected to the main processor pins and has NO BUFFERING to the outside world.
you can not “get rid of the cable” as such.
if you intend to use it for any type of communication you must have a small circuit of some type isolating the Pi and the outside world, which you may well be aware of.
depending what you wish to achieve it might be a good start to use a USB adaptor to develop the code and then work on using the internal port once you know your code is validated.
I am aware of the connection points and no nothing is connected directly to the outside world. It is connected to a SP202 which in turn is connected to an Isolated RS485 circuit. Works well and has for years. I am having trouble with getting the hardware UART to work on a Raspberry Pi3.
I see on the internet lots of info about the hardware UART, of which there are 2. I found that from Pi2 to Pi3, the design was changed so that instead of using a real UART, it uses mini-UART which is bit less stable and predictable, especially at higher baud rates. I came across this thread while looking for a solution. The suggested instability may not effect me, since I am running at 9600 bps, but also am not sure so am following it.
Notwithstanding that, using my digital scope, I do not see any data coming out of the TX pin. Very possible some of my attempts which involved tweaking the pi scripts/settings, may have screwed it up too.
In any case, since this appears to be a bigger issue and is not Xojo, I thought someone else may have found the solution, and share it saving me and others lots of time and frustration performing trial and error.
If you have it working, I would really like to know what you did to make it happen.
I only have the Pi2 and have never had a single issue, If I remember correctly, as it was a while ago, I just disabled the default behaviour of sending the boot up data to the port and it did everything as expected immediately, so basically no use to you at all sorry!
also I had a quick look at the thread and there is user stating he had no issue with the data to a PC but it was scrambled when using it direct, which is what should happen as he obviously does not know the USB adaptor is an inverter of the data polarity, as all such devices are, I expect you know this already.
at 9600 you are being nice and gentle with the hardware so I do not see any issues at all, maybe the port current is too low or there is simply not enough voltage to make the USB adaptor see a 1, it may also be there is some negative voltage leaking in to the USART, all I am sure you have been through that, but its possible to miss things as you know.
I perhaps would be tempted to buffer the USART output with a simple non-inverting transistor pair which would eliminate all such issues immediately.
I can not see any logical reason with what you describe to not have it working, please come back if you have a fix as I will at some point soon need to be moving onto Pi3.
For what it’s worth, I am using a Pi3 (latest Raspbian Pixel) with an RS485 transceiver connected to the main (h/ware) UART - and the Xojo serial tool works with it perfectly.
As I recall, I had to disable the serial port from connecting to a serial terminal at startup - and also I had to disable Bluetooth in order to free up the hardware UART so Xojo could connect to it.