Gambas 3.12.2 unable to receive serial data on Raspberry Pi
Posted
#1
(In Topic #759)
Trainee
I have written software, in Gambas3, to control my radio using the serial interface. It use to work fine.
Now I no longer receive data back from the radio, transmit still works, and the radio actions the command, but Gambas does not see the reply.
Set up is:
Raspberry Pi 3 (NO Bluetooth H/W) (for good measure I have also tried disabling bluetooth in config.txt!)
Gambas 3.12.2
Latest Raspian OS
I have named the serial port "ctrserial" and to receive data I use "ctrserial_read()".
The programme never gets the receive interrupt.
This situation is true for "ttyAMA0", "serial0" or "ttyUSB0" (using a USB to serial converter)
If I use gtkterm (on ttyAMA0, Serial0, or ttyUSB0) then the response from the radio is picked up by the RPi. Indicating to me that the H/W is functioning. (maybe gtkterm does not use the serial interrupt??)
This program use to work on an old version of Gambas (3.9?)
Has something changed? ( I should never have upgraded
Any help or ideas, much appreciated.
Posted
Trainee
in the FMain.form I named the serial port "serialport1" (yes its a different name to my first post, tried to start fresh!)
in the FMain.class I initialised the serialport as:
Code
Public Sub Form_Open()
rs232port1 = New SerialPort As "rs232port1"
rs232port1.Begin()
rs232port1.PortName = "/dev/ttyUSB0"
rs232port1.Speed = "4800"
rs232port1.Parity = SerialPort.None
rs232port1.DataBits = SerialPort.Bits8
rs232port1.StopBits = SerialPort.Bits2
rs232port1.FlowControl = SerialPort.Software
rs232port1.EndOfLine = gb.Windows
Try
rs232port1.Open()
rs232port1.send()
If Error Then
TextBox1.text = "Unable to open Serial port.Error:= " & Error
Else
TextBox1.text = "Serial port: " & rs232port1.PortName & " opened"
Endif
Endso far OK. BUT here is my mistake…
in FMain.form in order to set up the receive routine, I right clicked on the serial icon and selected "events" and the system automatically entered:
Obviously the "system" knows what its doing, sad though, that I had named my serial port "rs232port1" when I initialised it…..so nothing happened when receive data arrived.
It was just chance I spotted this….
OH well, almost two weeks of my life spent on this "silly" issue. Radio now back to working happily!
If it helps someone else… it was worth the effort! (maybe!)
1 guest and 0 members have just viewed this.




