Quectel module can not execute AT+COPS write command when using pyserial

144 views Asked by At

The problem is that the module (BG95 eval board) always (when I use the AT+COPS write command) returns: Error: device reports readiness to read, but returned no data (device disconnected or multiple access on port?) Edit: To be more specific, reading the serial port after sending (b'AT+COPS=0,2\r\n') does return nothing and gives the error message. Any further interaction with the serial port is not possible after this. However the device is then accessible from a different serial port.

This is how I set up the serial port:

serial.Serial(port=portname, baudrate=115200, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE, bytesize=serial.EIGHTBITS, timeout=0.5, exclusive=True)

I have:

  • Working serial connection for all commands except the AT+COPS write command, AT+COPS? f.e. works like a charm.
  • the knowledge that the command takes up to 180s, I respectivley set the serialPort.timeout variable to 180!
  • the working command, it works with the Quectel QNavigator the way I want to use it: AT+COPS=0,2 -- I do not specify the other two parameters, since I just want to change to automatic mode with operator format 2; operator choice is automatic and needs no value respectively.
  • SimCard inserted

I tried:

  • setting a manual timeout, since the readline() command terminates quite fast despite the 180s timeout
  • using read(1) instead of readline(), since it is not searching for LF.
  • using read_until()
  • using serialPort.in_waiting parameter, but it returns 0 before the AT+COPS command finishes.
  • a lot of different variations in my code, without any signs of hope.

What confuses me is, that the readline() command terminates well before the max timeout, with the error. If the device would not be ready, it should not get triggered. This means for me that the device is ready to answer and fails on the 'OK\r\n', which I cannot understand since it works for all commands. I would expect that I get an 'OK\r\n' just as with the other AT commands when I set the timeout to the higher value. After the command failed on the error, the port is not usable anymore, so I have to rescan my port values, typically it is then tty4 instead of tty3 and normally accessible. I have even seem, that it changed the provider in between, what can as well be the result of my attempt, which failed just on the response, but I don't know it for sure.

Did anyone face this problem, or know how to take care of it?

Best regards, Robert

1

There are 1 answers

0
Robert On

so it turns out, that the power supply was problematic.

I could not figure out why it didn't work, until I proceeded with other tasks as checking the power consumption using a BattLab-One usb tool. I used it to power the module and .. now it does not crash the serial port and provide a solid output using the AT+COPS=0,2 command. I will now hook up a battery to power the module. The serial port does still work with the usb-power switch off.

Regarding the previous power supply of the BG95 EvalBoard; I used a USB-Splitter, to use the power of two USB-Ports, it is not enough on a cheap laptop.. however my desktop which uses the QNavigator is powerful enough on one single usb port.

Sorry for disturbing, hope this post might help someone; if necessary, feel free to delete it.