Bluetooth File Transfer on RAK8211

Posted on
  • I would like to be able to send files over bluetooth to the RAK8211 board. This board uses the nRF52, so it should be possible to send data over bluetooth to it.
    I cant seem to see anything out of the box that would allow for bluetooth file transfer.
    I noticed that Espruino's filesystem library works with SD cards, and one of the arguments is a source path.

    Would it be possible to use a bluetooth address as the source path instead of the SD card directory?
    I realise this may require 'hacking' espruino codebase to be able to do what I need to do.

    Alternatively there is the nRF connect app which is used to access the device and upload firmware to it. We are currently using the nRF toolbox to flash the firmware to the device. I suspect there could be some way to upload files using the same interface.

    Do you have any ideas how I could do this?

  • There's nothing specific built in, but it's trivial to do it by sending the JS code to write a file over the console interface.

    Assuming you want to use the built-in Storage library (because that's easy and doesn't require an SD card - which you couldn't add on the RAK8211 anyway as you don't have enough free pins):

    In your app, load the file, and convert it to base64 (btoa in JavaScript) and then send the following text over the bluetooth UART: "\x03\x10require('Storage').write('filen­ame',atob('your_base64_encoded_data'))\n­`

    That'd be trivial to make as a Web Bluetooth page, and we had been considering providing that as a tool - but there is currently no existing app or standard that will just transfer a file over Bluetooth

    and one of the arguments is a source path.

    I don't understand I'm afraid - could you point me to the function/code you mean?

  • The problem with this approach is that the data is a 30kB hex file, its not something I can easily type into the console on the Web IDE. However I think I may have found a solution, by uploading this data with the firmware hex file I could write it to the Espruino's flash directly.

    I can then use the nRF toolbox app to write this modified firmware to the nRF chip.

  • its not something I can easily type into the console on the Web IDE

    No, I'm suggesting that you'd create something like a Web Bluetooth website to handle it.

    Storage only handles about 40kB total on nRF52s so yes, if you want that kind of thing built in you're probably better off building it into a custom firmware.

  • Thanks.

    I actually did this today, using bin2c.exe to convert the binary data to a .h file which I included in Espruino/targets/nrf5x, then using a jsWrapper to return the address of that array from the .h file.
    It seems to work pretty well. Now I can create a loop in my javascript to retrieve that data and I can re-flash that data using the nRF toolbox app in DFU mode.

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Bluetooth File Transfer on RAK8211

Posted by Avatar for Nadnerb @Nadnerb

Actions