Running non-example code on the board

Hello, I have successfully flashed the examples onto the board using this tutorial https://learn.sparkfun.com/tutorials/us … plications . I now am looking to run my own model. I attempted to do so by replacing the tensorflow_person_detection.bin with my own model’s bin file, and then altering the makefile so that is corresponded with the name of my model’s file. Unfortunately, I received this error:

Sending OTA Descriptor = 0xfe000

Sending Update Command.

number of updates needed = 18

Sending block of size 0x2bf44 from 0x4c8660 to 0x4f45a4

Sending Data Packet of length 8180

Sending Data Packet of length 8180

Sending Data Packet of length 76

Received NACK

msgType = 0x8

error = 0x7

seqNo = 0x0

Upload failed: No ack to command

Failed to ack command

Fail

Tries = 3

Upload failed

Does anyone have an idea on how to flash custom models to the board or what the issue is with my process?

For context, I am running Ubuntu 22.04 on a virtual machine.

Thanks!

It could be a lot of things…

  1. Verify Model Compatibility

Ensure that your model is compatible with the SparkFun Edge board. The board uses TensorFlow Lite for Microcontrollers, so the model must be converted appropriately using the TensorFlow Lite converter for microcontrollers.

  1. Model Conversion

Double-check that you have correctly converted your model to a .bin file using the TensorFlow Lite converter. Make sure the conversion process includes optimization steps suitable for microcontrollers.

  1. Check Makefile Modifications

Ensure that you have correctly modified the Makefile to point to your custom model’s .bin file. Verify that the path and file name are correct and that there are no typos.

  1. Flashing Process

Retry Flashing: Sometimes, simply retrying the flashing process can resolve intermittent communication issues.

Reduce File Size: If your model’s .bin file is significantly larger than the example provided, it might cause issues. Try using a smaller model to see if the flashing process succeeds.

  1. Debugging the Error

The specific error messages you received (Received NACK, error = 0x7, Upload failed: No ack to command) indicate an acknowledgment issue during the flashing process. This could be due to several reasons:

Buffer Overflow: The data being sent might be too large for the buffer on the board. Try reducing the size of your model and see if the problem persists.

Communication Timeout: There might be a timeout issue during the data transfer. Ensure that your VM and host machine are not causing delays in communication.

  1. Virtual Machine Considerations

Running on a virtual machine adds another layer of complexity. Ensure that the VM has sufficient resources allocated and that USB pass-through is correctly set up to communicate with the SparkFun Edge board…if you have another PC/board that runs linux you can use it to test as well

You could also verify your work process by renaming the default bin file(s) and confirming that an otherwise default bin (renamed) uploads and works correctly

Finally, GPT4 thinks this will work:

Example Makefile Section

Ensure your Makefile section for flashing your model looks something like this:

MODEL_BIN := tensorflow_person_detection.bin
# Change to your custom model file name
MODEL_BIN := your_custom_model.bin

flash: $(MODEL_BIN)
    @echo "Flashing $(MODEL_BIN) to the board"
    python3 flash.py --bin $(MODEL_BIN)

Replace your_custom_model.bin with the exact name of your converted .bin file.

Thank you for the help!

The model is a tensorflow lite model so it should be compatible with the board and the c array is compiled correctly. Additionally, the name of the file has no effect. I have reduced the model substantially by reducing the filters in my convolutional layers and quantizing the model. The C array for my model is now only has a length of 5000, which according to this repo: https://github.com/advaitjain/tflite-mi … el_data.cc is about 6 x smaller than the person_detection example.

However, I think I found the issue. When I look at the person_detection.bin file that I have been able to flash, it is only 291 kB. Whereas when I make the binary, as per this repo https://github.com/advaitjain/tflite-mi … e-examples , the binary file it creates is 12.9 MB which is way larger than what the board can handle. So, it appears that making the binary by following the repo I linked is not a valid option.

Does anyone have any knowledge on how the original pre compiled person_detection.bin file - found here https://github.com/sparkfun/SparkFun_Ap … ection.bin - was made?

I was able to sort out the issue. I created a repo to outline my steps:

https://github.com/h-tye/SparkFun-Edge-Demo