This is code for the NRF52840 dongle (pca10059) for communicating between the VESC and VESC Tool (linux and mobile) over BLE. After uploading the firmware, the NRF can be connected to the VESC using the RX and TX pins chosen in main.c, 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. The NRF can also communicate with the VESC Remote at the same time as it runs BLE.
The code can be build with the NRF52 SDK by changing the path in Makefile.
- Download and install nRF Connect for Desktop.
- Click
Add/remove apps
and installProgrammer
application. - Plug the dongle to USB port and click reset button to enter DFU mode. Red diode should start blinking.
- Select device from the list.
- Click
Add HEX file
and selectnrf52840_xxaa.hex
from_build
directory. - Click
Add HEX file
and selects140_nrf52_6.1.1_softdevice.hex
fromSDK_ROOT\components\softdevice\s140\hex
directory. - Click
Write
to flash the device.
The nRF52840 Dongle can be powered from different sources.
-
Internal regulator (5 V). The default power supply of the nRF52840 Dongle is the USB interface. The USB interface supplies power to the on-chip high voltage regulator of the nRF52840 SoC. The USB power connection (VBUS) is also available along the board edge
-
External regulated source (1.8–3.6 V). The nRF52840 Dongle can also be configured to be supplied from an external regulated
1.8–3.6 V
source through theVDD OUT
connection point. To enable this,SB2
must be cut andSB1
must be soldered.
After the code is uploaded, the NRF52 can be connected to the VESC in the following way:
NRF52840 dongle | VESC |
---|---|
GND | GND |
VDD OUT/ VBUS* | 3.3V/5V* |
TX (P0.29) | RX |
RX (P0.31) | TX |
*The nRF52840 Dongle can be powered from different sources.