This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can I use USB in a bootloader on the nRF52840?

Before I try something which is technically impossible....

Does anyone know if the USB functions on the nRF52840 would work in the bootloader, or only in the application?

  • Iirc, in the latest SDK the 32 doesn't even work over UART. So the chance that the 40 works over USB seems pretty low right now.

  • The USB UART example does work, as an application, and in another thread someone is using BLE as well as USB (though they initially had some issues getting it to work)

    But I wondered if there was anything specific about the USB stack and interrupts, or just the size of the USB code which would preclude it being used in a bootloader.

    From what I recall, the application start address can be modified if the bootloader needs to be bigger, but if I"m not correct, I suspect this may not be possible

  • Nothing would stop you using USB as a transport for the bootloader, you could absolutely do it. The bootloader was originally written to be modular, with UART and BLE transports, but the UART got dropped because I don't think many people used it. Writing a USB version of that transport would be possible and then you get to use the rest of the bootloader code for free.

    If you're going to do it, making it as simple as possible would keep the code size down and yes you can make the bootloader larger if you need and it probably would be larger. What driver were you intending on using on the PC end? If it's something complicated like CDC then the code will get a bit large, a custom dumb control channel + data endpoint would be smaller but then you have to write the driver.

  • @RK

    Thanks.

    I would need something on the nRF52840 side that didnt need a special driver on the PC / Mac / Linux side.

    So CDC was a possibility as all those OS's have a built in CDC driver, (though its a bit tricky on Windows 7 and 8 to convince Windows to use its built in driver).

    Another possibility could be HID, but I'd need bi-directional comms, and although I think thats possible, I have only used a keyboard / Mouse / Joystick HID device before which was input into the PC

    So I'd need to do some more research around bidirection comms.

    Mass storage may be another option, but I have a feeling that would be even more complicated as I'd need a fake FS on the nRF52840 side

  • @rogerclark
    We are working on a USB-CDC bootloader as well. Unfortunately it looks as if we don't have resources to get it into the next sdk release. However, we might be able to send you an experimental prerelease after we do the next sdk release in about a month or so.

Related