DFU over SPI slave interface

If you have a simple question and just want an answer.
PVS_Bram
Junior Member
Posts: 6
Joined: Fri Jan 12, 2024 11:20 am

DFU over SPI slave interface

Post by PVS_Bram »

Hi everybody

We recently bought the XCORE.AI XK-AUDIO-316-MC-AB to research the ease of implementation in USB audio applications. Using the "app_usb_aud_xk_316_mc" application a firmware was built that exactly fits our needs in no time(Stereo Asynchronous USB IN/OUT, I2S slave IN/OUT config, bit depth of 24 bits with a sample rate of 48000 Hz). The problem we are experiencing now is the possibility to update the firmware of a device when in field. There are some topics that are related to my questions but none answer my specific topics.

The XMOS XU316-1024-TQ128 will most likely be paired with an ESP32 MCU to provide both Bluetooth and USB connectivity in the same product. We would like to interface the XMOS chip to the ESP32 MCU via an SPI interface and use this interface to transfer the new Firmware image. Now regarding the questions:
  1. Is it possible to use the SPI interface on the XU316-1024-TQ128? I noticed the SPI library is bitbanged,I thus expect this should not be a problem.
  2. The DFU examples/library in lib_xua only seem to support firmware updates via USB. Are there any examples that show a DFU via an SPI interface?
Thank you for you advice in advance. Do not hesitate to ask for more details if needed.

Bram


User avatar
fabriceo
XCore Addict
Posts: 186
Joined: Mon Jan 08, 2018 4:14 pm

Post by fabriceo »

Hi,
you have an alternative which is to systematically boot the XU316 from a SPI master (esp32) instead of the flash, just by reconfiguring the boot pins. look in the xu316 data sheet chapter 9 boot procedure;

now if you prefer to have a fix program in the flash and go with an upgrade process launched by ESP32 then I m afraid you have to write everything from scratch.

by leveraging the code from the DFU library (like flash_interface.c) you can write a new image in flash at the proper place. you will need a task in the XU316 to bridge the SPI (slave) communication, buffering the image and finally launch the flash-write sequence and reboot.
a good subproject ant can't see any problems :)
Joe
Member++
Posts: 24
Joined: Sun Dec 13, 2009 1:12 am

Post by Joe »

Just a note that if you're only running a simple stereo USB app then you also have the option of using the QF60 package as it's quite a lot smaller and a bit cheaper. XU316-1024-QF60B (for 3.3V IO). Would just need to change the XN file and rebuild the same code.

For booting, fabriceo seems to have covered it, another option would be to have the ESP32 directly reprogram the upgrade image in the flash that the XU316 boots from (this just requires a SPI interface also). The DFU mentioned in lib_xua is a specific type specified by USB Implementers Forum. DFU by any other interface is a custom method which is entirely possible but you'd have to write it yourself.