-
Notifications
You must be signed in to change notification settings - Fork 5
Description
Thanks for this great project - I'm porting it to a R-Pi Pico & ran into two issues, I'm submitting as one since not sure if they are related to some changes I made or maybe some uncommited changes on your end, can clean them up if you prefer.
#1 is write_address_register and write_data_register don't seem to use the data arguments:
https://github.com/psobot/arduino-coldfire-bdm/blob/main/arduino_coldfire_bdm/bdm_interface.py#L218
I had to change them as e.g.,:
#return self._send_then_receive(0x2088 | register_number)
return self._send(0x2088 | register_number, data >> 16, data & 0xFFFF)
For this one I don't see how the code works as-is, so wondering if it was just a case of a comit was missing?
#2 may or may not be a bug, it's at:
| status = int(response[0] == b"N") |
It looks like the arduino sends Y/N for 1/0 ( Serial.print(packet.status ? "Y" : "N");).
This line inverts the output (when N it puts status as 1).
The code as written however does work, because of another bug. When slicing the output of read() to a single element it returns an integer.
I changed that logic to:
if response[0] != ord('N') and response[0] != ord('Y'):
raise IOError("response[0]: " + str(response[0]))
status = int(response[0] == ord('Y'))
Thanks,
-Colin