This is code for a NRF51822 for communicating between the VESC and VESC Tool (linux and mobile) over BLE. After uploading the firmware it can be connected to the VESC as in the picture, and the BLE scanner in VESC Tool should be able to find it and connect. Note that the UART port on the VESC must be enabled with a baud rate of 115200 for this to work.
This should work with any NRF51822 module, such as this one that I'm using:
The code can be build with the NRF51822 sdk by changing the path in Makefile, but for convenience a prebuild hex file is also included. It can be uploaded with openocd by running the following script:
The upload script assumes that the NRF51822 is connected over SWD using an stlink v2 with the following connection:
After that it can be connected to the VESC in the following way
Note that a 10 uF ceremaic capacitor between vcc and gnd close to the NRF51 module might be needed if the cables are long. Otherwise the connection can become slow and unstable.