I’m running a very simple script in an RV50 modem.
I can Write to the serial port with no problems. but I cannot read from it.
The same code run on a GX400 works without any issues Reads from the serial port work as expected. Are there any hotfixes for the RV50 that might solve this issue? Or is there a different way to read the data on the RV50.
local serialPort, err = serial.open(_portval, _configval)
buffer = {0x01, 0x03, 0x00, 0x03, 0x00 ,0x01, 0x74, 0x0A}
serialPort:settimeout(3) -- set a timeout in seconds
while true do
local full_buffer, err, partial_buffer = serialPort:read(4) -- read data from serial port
if full_buffer then
print(full_buffer)
elseif partial_buffer then
print(partial_buffer)
else
if not string.match (err, 'timeout') then -- if this wasn't a timeout with no data
return nil, err
end -- else timeout with no data, continue waiting...
end
end
There is no known issue on RV50 serial port read. Iwould recommend to try different flow control setting, more specifically try to disable hardware flow control. It is possible that the hardware default are not the same on the GX and the RV.
To disable flow control: flowControl = “none”, in the config table when you open the port.
Flow Control is already disabled.
local serialConfig = { parity = “none”, flowControl = “none”, numDataBits = 8, numStopBits = 1, baudRate = 9600}
This is a “known” defect? I was not able to find any information on this defect. It seems like a pretty significant bug I’m using it as an LS300 replacement because of its flash memory defect but now I’m stuck on a new defect for a modem twice the price.
Is there any other work-arounds to this problem? is it possible to enable flow control and jumper the control wires?
I wrote: “There is no known issue on RV50 serial port read”. In other words: we never saw that issue.
Another tip: did you make sure to reserve the serial port for AAF? Do you have another application reading on the serial port?
I will need more information on your setup so we can try to reproduce your issue:
Version of ALEOS
Hardware that you a tying to connect on the serial port
Oh yes sorry, I see that “no known issues” now next time I reread the replies.
I’m just trying to connect to another computer’s serial port to get data to come out. Again I know it is connected correctly because my GX400 can send and receive data, and the RV50 can send data.
Firmware:4.5.2.004 (this one lets me write but won’t read)
I’ve also tried a brand new load load from Sierra Wireless 4.5.3 (this one won’t let me read OR write).
This is the serial port read function that doesn’t work on the RV50 but does work on the GX400
local serialConfig = { parity = "none", flowControl = "none", numDataBits = 8, numStopBits = 1, baudRate = 9600}
buffer = {0x01, 0x03, 0x00, 0x03, 0x00 ,0x01, 0x74, 0x0A}
local serialPort, err = serial.open('/dev/ttyS0', serialConfig )
serialPort:settimeout(3) -- set a timeout in seconds
while true do
local full_buffer, err, partial_buffer = serialPort:read(4) -- read data from serial port
if full_buffer then
print(full_buffer)
elseif partial_buffer then
print(partial_buffer)
else
if not string.match (err, 'timeout') then -- if this wasn't a timeout with no data
return nil, err
end -- else timeout with no data, continue waiting...
end
end
I also tried on 4.5.2, 4.5.3.E04 and once again it worked flawlessly. I would recommend to check your hardware setup, and the flow control on the PC side.
Here is the code I run on 4.5.0, 4.5.2 and 4.5.3 and worked OK:
local sched = require 'sched'
local shell = require 'shell.telnet'
local serial = require 'serial'
local function main()
print("start")
local serialConfig = { parity = "none", flowControl = "none", numDataBits = 8, numStopBits = 1, baudRate = 9600}
buffer = {0x01, 0x03, 0x00, 0x03, 0x00 ,0x01, 0x74, 0x0A}
local serialPort, err = serial.open('/dev/ttyS0', serialConfig )
serialPort:settimeout(3) -- set a timeout in seconds
while true do
local full_buffer, err, partial_buffer = serialPort:read(4) -- read data from serial port
print(full_buffer, err, partial_buffer)
serialPort:write(full_buffer or partial_buffer or "")
end
end
sched.run(main)
sched.loop()
Thanks for helping me work through this problem I believe I have resolved it now.
Apparently you have to enable the com port in Acemanager for the serial port to work. It is not enough to reserve the port for ALEOS and open the port in the LUA script it must be enabled. Or else you get odd behaviours like being able to send but not receive.
I’m not exactly sure if any of the settings in the comm port actually matter because in the lua script you specify baud rate etc. So my guess is it just needs to be enabled.
Again thanks for the help and Sierra Wireless directly for finding the problem.