nRF52840 USB_CDC and BLE

Discussion and questions about boards that can run MicroPython but don't have a dedicated forum.
Target audience: Everyone interested in running MicroPython on other hardware.
Post Reply
wrickert
Posts: 6
Joined: Sat Apr 13, 2019 2:23 am

nRF52840 USB_CDC and BLE

Post by wrickert » Thu Oct 31, 2019 9:35 pm

I am trying to get both USB_CDC and BLE to work at the same time. I had this working at one point but now it does not work for me.

If I remove ubluepy then USB_CDC works reliably. I know there is a way to do both but I lost it.

I am working with PCA10056, I added `#define MICROPY_HW_USB_CDC` to the mpconfigboard.h so it behaves like a PCA10056
but with PCA10059's USB_CDC

I guess what I need to know is what configurations are needed to enable both, and what flash command to use. The documentation is somewhat confusing as to what make commands to use? make BOARD=pca10056 sd? make BOARD=pca10056 flash? Some combination thereof? Any help is appreciated.

c45713
Posts: 46
Joined: Fri Dec 09, 2016 7:09 pm

Re: nRF52840 USB_CDC and BLE

Post by c45713 » Fri Nov 01, 2019 6:40 am

Hi wrickert,

I used the pca10056 board when developing the PR for the pca10059.
You are correct, the only change needed to get it spinning is to add `#define MICROPY_HW_USB_CDC (1)` in the mpconfigboard.h to make it use USB CDC instead of regular Segger UART.

Next i do the following:

Code: Select all

make BOARD=pca10056 SD=s140
make BOARD=pca10056 SD=s140 sd
The `sd` Makefile target will flash both the SoftDevice and the application. If you already have the SoftDevice on board, you can go directly to `flash` which will only flash the application, in this case at address 0x26000.

Does this work for you?

wrickert
Posts: 6
Joined: Sat Apr 13, 2019 2:23 am

Re: nRF52840 USB_CDC and BLE

Post by wrickert » Fri Nov 01, 2019 8:59 am

Not reliably, no. I've tried two different computers. What seems to happen is that eventually, some combination of flashing seems to take, but it is an extremely unreliable process.

c45713
Posts: 46
Joined: Fri Dec 09, 2016 7:09 pm

Re: nRF52840 USB_CDC and BLE

Post by c45713 » Fri Nov 01, 2019 9:34 am

It is a bit hard to tell what is going wrong here.
Which revision of the board do you happen to have?

You can also try the manual steps, just to make 100% sure you are flashing the correct files:

Code: Select all

nrfjprog --program drivers/bluetooth/s140_nrf52_6.1.1/s140_nrf52_6.1.1_softdevice.hex --sectorerase -f nrf52
nrfjprog --program build-pca10056-s140/firmware.hex --sectorerase -f nrf52
I got my switches on my board in these positions:

Code: Select all

VEXT->nRF = OFF
nRF power source = VDD
nRF Only|Default = Default

wrickert
Posts: 6
Joined: Sat Apr 13, 2019 2:23 am

Re: nRF52840 USB_CDC and BLE

Post by wrickert » Fri Nov 01, 2019 9:52 am

Mine is a custom board using the BMD-340 module. I will try those steps.

wrickert
Posts: 6
Joined: Sat Apr 13, 2019 2:23 am

Re: nRF52840 USB_CDC and BLE

Post by wrickert » Fri Nov 01, 2019 2:58 pm

That does seem to be more stable. Thank you.

User avatar
devnull
Posts: 454
Joined: Sat Jan 07, 2017 1:52 am
Location: Singapore / Cornwall
Contact:

Re: nRF52840 USB_CDC and BLE

Post by devnull » Tue Jan 07, 2020 11:58 pm

Hi;

I am in the same situation, I am using the holyiot_18010 ( http://www.holyiot.com/eacp_view.asp?id=278 ) and have connected VUSB, D+ and D- and Ground, and powered the device via this usb connection.

In my mpconfigboard.h I have changed:

Code: Select all

// USB
#define MICROPY_HW_USB_CDC            (1)

// UART config
#define MICROPY_PY_MACHINE_UART       (0)
However, on connecting the board, no serial port is shown in the /dev devices and lsusb shows nothing either !

Other than connecting D+, D- VBUS and GROUND, were there any other hardware modifications needed, or additional code to change ??

Any suggestions or hints on how you got yours to work ??

Post Reply