However... I was running into another issue that somebody might clarify / explain.
So I'm basically doing:
Code: Select all
self.serial = UART(port)
self.serial.init(9600, bits=8, parity = 0, timeout = 500)
self.serial.write(txdata)
ans = self.serial.read(1)
... check for acknowledge etc
The target board happily responds with 0x00 immediately afterwards as an acknowledge byte (confirmed on the logic analyser). After another 40msec I get the rest of the response (7 Bytes).
The script is written such that read(1) first checks the ack byte, then another read(3) reads the header etc. as it parses through the received data.
However, read(3) does not return 3 bytes but only one byte...
So if I do
Code: Select all
ans = self.serial.read(1)
print (ans)
ans = self.serial.read(1)
print (ans)
ans = self.serial.read(1)
print (ans)
Code: Select all
ans = self.serial.read(1)
print (ans)
ans = self.serial.read(3)
print (ans)
ans = self.serial.read(2)
print (ans)
Am I missing something here? Has anybody experienced a similar thing?