Hobbyist Toolkit

cancel
Showing results for 
Search instead for 
Did you mean: 

UART and GPIO problems with Raspberry pi 4b (BCM2711)

Solved!
Go to solution

I have connected my raspi to the RS-485 hat for the pi from Seeed. (I also communicate from my Labview PC with the raspi over ethernet cable.) The RS-485 has the MAX485 chip which is a single to differential signal converter. The problem is the driver for the GPIO addressing. So far I was not able using Linx 2020 version to just put a LED on or off on the raspberry using the GPIO. (I tried the same principle with python code. No problems there.) So I assume there is a driver issue with the BCM2711 chipset ? Any solution to make the default UART work over raspi pins 14 and 15 ? 

(ps: to make the RS-485 work, also GPIO 18 needs to be put to high for sending, or low for receiving.)

0 Kudos
Message 1 of 7
(6,524 Views)

I found this link where one can write his own driver. Is there any other solution ?

https://www.labviewmakerhub.com/doku.php?id=learn:tutorials:libraries:linx:misc:custom_command_examp... 

0 Kudos
Message 2 of 7
(6,510 Views)

@wmswe wrote:

I found this link where one can write his own driver. Is there any other solution ?

https://www.labviewmakerhub.com/doku.php?id=learn:tutorials:libraries:linx:misc:custom_command_examp... 


That link is mainly for the wiring devices (aka Arduino family). Raspberry Pi has a different architecture and in the case of uart a rather confusing change of functionality for the uart ports across model numbers. Try to read this page about the topic and if you are at the end of it not confused: congratulation, you seem to have a very sharp mind 😀.

 

Basically the Linx software only supports one UART at the moment on the Raspberry Pi and that is the port which gets installed in Raspbian as /dev/ttyAMA0.

 

This is also called the first PL011 UART by the documentation. Now depending on the Raspberry Pi model you have this is either connected to the primary UART (Raspberry Pi Zero, Raspberry Pi 1 and Raspberry Pi 2) or to the secondary UART which is connected to the Bluetooth serial port on the Wifi chip (Raspberry Pi 3 and Raspberry Pi 4).

 

The other UART channel is a miniUART device and present on the system as /dev/ttyS0 (which Linx currently doesn't support). This is connected to apparently nothing on the Zero's up to Raspberry Pi 2 and to the primary UART on Raspberry Pi 3 and 4.

 

The primary UART is what is connected to the GPIO 14 and 15.

 

Now there are three problems you need to solve.

 

1) Modify the source code of liblinxdevice.so to also support /dev/ttyS0

2) enable the miniUART support in your Raspian system as it is disabled by default

3) disable the Linux console which by default goes to the primary UART as you can't open it otherwise in Linx

 

Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 7
(6,495 Views)

Thank you very much for your reply. I found the source files for the .so library here: https://github.com/MakerHub/LINX/blob/master/LabVIEW/vi.lib/MakerHub/LINX/Firmware/Source/core/devic... 

I will need to set up gcc and take a deeper look into the uart configuration for the raspi.

 

 

0 Kudos
Message 4 of 7
(6,490 Views)
Solution
Accepted by topic author wmswe

Hi,

The LINX digital I/O channel numbering is the connector pin number.

GPIO 18 is LINX channel number 12. See https://www.labviewmakevirhub.com/doku.php?id=learn:libraries:linx:device:raspberry-pi-2-b and https://pinout.xyz/ for more information.

 

It may be possible to access the UART using the VISA library.

 

On the PI desktop I set the config to

pi_config.png

 

I then created a LabVIEW project for the PI containing the attached VI. 

The VI sets GPIO 18 and writes a string to the UART.

 

Cheers,
Andy.

 

Message 5 of 7
(6,475 Views)

Hi Andy. Thank you very much for your help. 

I went step-by-step over the settings and now all is working fine. 

 

Since I had written the same Labview code as you in the first place, the problem was the enabling of the serial/SPI/I2C and disabling the serial for terminal access.

Use 'sudo raspi-config' -> 5. interfacing options -> enable P4 and P5, enable serial access, disable serial terminal access.

 

Thank you. Problem solved. I am closing this issue.

0 Kudos
Message 6 of 7
(6,433 Views)

Hi Andy,

Could I know if you have tried the Linx Toolkit API before using the VISA Functions to solve the problem

Thanks.

 

Cyong

0 Kudos
Message 7 of 7
(5,104 Views)