OTA update for Raspberry Pi Pico

Hello,

I’m trying to setup over the air(OTA) updates for a Raspberry pi pico + notecard running circuit python. The code.py fie I would like to update is ~16Kb so I am attempting to do this via the large file upload procedure.

I’m unsure of next steps with Circuit Python when it’s time to read the binary data as issuing a “req”: “card.binary.get” doesn’t seem to output anything. I was hoping I could load this binary into a variable and just save the variable to a file then restart the device. Any examples of OTA updates for Raspberry pi on circuit python would be great! Also the DFU documentation doesn’t include raspberry pi’s.

Hi @bkauf,

Make sure your Notecard firmware is on at least v5.3.1 (I assume it is, but I just want to make sure!) and you’re following these instructions to use the card.binary APIs.

Normally I would suggest using Outboard Firmware Update, but there are limitations on the Pico itself that prevent it from being supported.

Rob

Hi Rob,

Thank you for the quick response. I am using v5.3.1. I’ve spent too many hours trying to troubleshoot and I cannot seem to get access to the downloaded data in the binary buffer of the nodecard.

The following code shows that the data has been loaded into the binary buffer but I cannot seem to access it. Any suggestions would be greatly appreciated.

req = {"req": "web.get"}
req["route"] = "updates"
req["binary"] = True
rsp = card.Transaction(req)
       
verifyDownload = card.Transaction({"req":"card.binary"})
print("Verify Download")
print(verifyDownload)
getFileData = card.Transaction({"req":"card.binary.get"})

print("Get File Data")
print(getFileData)

Output

Using transaction timeout of 30 seconds.
{"req":"card.binary","crc":"0002:21904900"}
{'status': '3955f35bcaa109fe75a1f3cd69d7d1e6', 'crc': '0002:2DB2CDC7', 'connected': True, 'max': 130554, 'cobs': 16353, 'length': 16288}
Verify Download
{'status': '3955f35bcaa109fe75a1f3cd69d7d1e6', 'crc': '0002:2DB2CDC7', 'connected': True, 'max': 130554, 'cobs': 16353, 'length': 16288}
Using transaction timeout of 30 seconds.
{"req":"card.binary.get","crc":"0003:e8b33053"}
{'crc': '0003:2C588317', 'status': '3955f35bcaa109fe75a1f3cd69d7d1e6'}
Get File Data
{'crc': '0003:2C588317', 'status': '3955f35bcaa109fe75a1f3cd69d7d1e6'}
publishSystemData finished ... 1708868887

Nothing else comes across the console. I’m expecting a flood of binary code but the above output is all I see.

Quick update - I was able to break my payload file into multiple pieces and grab them with the web.get route manually not using the binary option. This seems to solve the use case I had.

FYI if you’re using the latest version of note-python, there are card.binary helper functions you can use as well: note-python/notecard/binary_helpers.py at 3ecb772bd6b1a28d93bf9c0e45fd5a93ed241f9b · blues/note-python · GitHub

Rob