I am using the Sparkfun Pro nrf52840 Mini (https://www.sparkfun.com/products/15025 … 7c04243893). I have also designed a custom board following the schematics of the Sparkfun Pro nrf52840 Mini which has multiple I2C ports and some other minor changes. After uploading the proper bootloaders on both the boards I am successfully able to detect both the boards in the Arduino IDE. I can compile the code in the Arduino IDE and also can upload it. The problem is when I upload the code, both the boards get disconnect from the Arduino IDE. I then have to double press the RESET button so that the boards again get detected by the Arduino IDE. After which I open the serial monitor from the Arduino IDE and expect to see the sensor value that is connected to the i2c port via the qwiic connector but it doesn’t. I can read the sensor only sometimes. What works sometime is RESETing the boards so that they get detected by the Arduino IDE. Then I click the button in the Arduino IDE to upload the code and quickly open the serial monitor too while the code is still uploading. Sometimes the boards stay connected and if I am in luck the sensors start streaming data. This streaming runs forever for the Sparkfun board but stops after a while for my custom board. Don’t know why?
Is the boards getting disconnected from the Arduino IDE after uploading the code normal? Has anyone experienced this? If this is not normal what am I doing wrong? I have currently upload the 0.2.8 version of the bootloader from the Adafruit GitHub page (https://github.com/adafruit/Adafruit_nR … r/releases).
Please let me know if you want any sort of details. I am in a time crunch and a prompt response is much appreciated. Thank you for reading!
Thank you Chris for the reply! I am indeed on Linux system. I followed the two suggestions made in the post you suggested. It didn’t change anything. When I upload the code on the nrf boards (my custom and Sparkfun Pro nrf52840 Mini) they still get disconnected from the Arduino IDE as well as from the computer (don’t show up as USB drives). What other debugging steps would you suggest?
# Rule to blacklist SparkFun USB boards from being manipulated by ModemManager.
# Fixes issue with hanging references to /dev/ttyACM* devices
ATTRS{idVendor}=="1b4f", ENV{ID_MM_DEVICE_IGNORE}="1"
What is “1b4f”? Is it the name of the Sparkfun device that should get recognized by the computer as a USB device? I checked the name for my nrf device using lsusb command. Nothing appears. Meaning, there is a BUS device and ID but no name!
My results from lsusb before and after connecting the sparkfun board is
Before connecting the board
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 003: ID 093a:2521 Pixart Imaging, Inc. Optical Mouse
Bus 003 Device 002: ID 1532:0214 Razer USA, Ltd
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 009 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 008 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 008 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
After connecting nrf board
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 016: ID 239a:8029
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 003: ID 093a:2521 Pixart Imaging, Inc. Optical Mouse
Bus 003 Device 002: ID 1532:0214 Razer USA, Ltd
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 009 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 008 Device 002: ID 2109:3431 VIA Labs, Inc. Hub
Bus 008 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
1B4F is SparkFun’s USB vendor ID and that’s coming from the bootloader we have on the Pro nRF52840. It’s associated with the COM port that the board creates.
Have you double checked that you’re on the right COM port? At least in Windows, I have noticed that the COM port changes depending on if you’re in bootloader or running code. On my computer it shows up as COM140 in bootloader but once my code begins executing the COM port goes up by one to COM141 and an error message is generated in the IDE. To upload new code, you need to change the COM port to the new number.
If that’s still not working, give a Windows PC a try and see if things work. Another option would be to ground pin 2 and then push the reset button to restore the bootloader.
Yes, I am selecting the correct port. I tried uploading the code from Windows. On Ubuntu at least the code got uploaded and the board got disconnected after that. On Windows the code does not even upload. I get the classic error
Upgrading target on COM1 with DFU package C:\Users\colab\AppData\Local\Temp\arduino_build_557622\nrf_example_code.ino.zip. Flow control is disabled, Single bank, Touch disabled
Timed out waiting for acknowledgement from device.
Failed to upgrade target. Error is: No data received on serial port. Not able to proceed.
Traceback (most recent call last):
File "nordicsemi\__main__.py", line 294, in serial
File "nordicsemi\dfu\dfu.py", line 235, in dfu_send_images
File "nordicsemi\dfu\dfu.py", line 200, in _dfu_send_image
File "nordicsemi\dfu\dfu_transport_serial.py", line 179, in send_start_dfu
File "nordicsemi\dfu\dfu_transport_serial.py", line 243, in send_packet
File "nordicsemi\dfu\dfu_transport_serial.py", line 282, in get_ack_nr
nordicsemi.exceptions.NordicSemiException: No data received on serial port. Not able to proceed.
Possible causes:
- Selected Bootloader version does not match the one on Bluefruit device.
Please upgrade the Bootloader or select correct version in Tools->Bootloader.
- Baud rate must be 115200, Flow control must be off.
- Target is not in DFU mode. Ground DFU pin and RESET and release both to enter DFU mode.
I am aware of the trick, ground pin 2 and press RESET button, but unfortunately I have never gotten it to work. I am connecting the ground pin on the board to pin 2 with a small wire and then I plug in the board to the computer with a USB cable and press the RESET button. Isn’t this the right way? How else am I supposed to do it?
Radhen:
Yes, I am selecting the correct port. I tried uploading the code from Windows. On Ubuntu at least the code got uploaded and the board got disconnected after that. On Windows the code does not even upload. I get the classic error
Upgrading target on COM1 with DFU package C:\Users\colab\AppData\Local\Temp\arduino_build_557622\nrf_example_code.ino.zip. Flow control is disabled, Single bank, Touch disabled
Timed out waiting for acknowledgement from device.
Failed to upgrade target. Error is: No data received on serial port. Not able to proceed.
Traceback (most recent call last):
File “nordicsemi_main_.py”, line 294, in serial
File “nordicsemi\dfu\dfu.py”, line 235, in dfu_send_images
File “nordicsemi\dfu\dfu.py”, line 200, in _dfu_send_image
File “nordicsemi\dfu\dfu_transport_serial.py”, line 179, in send_start_dfu
File “nordicsemi\dfu\dfu_transport_serial.py”, line 243, in send_packet
File “nordicsemi\dfu\dfu_transport_serial.py”, line 282, in get_ack_nr
nordicsemi.exceptions.NordicSemiException: No data received on serial port. Not able to proceed.
Possible causes:
Selected Bootloader version does not match the one on Bluefruit device.
Please upgrade the Bootloader or select correct version in Tools->Bootloader.
Baud rate must be 115200, Flow control must be off.
Target is not in DFU mode. Ground DFU pin and RESET and release both to enter DFU mode.
I am aware of the trick, ground pin 2 and press RESET button, but unfortunately I have never gotten it to work. I am connecting the ground pin on the board to pin 2 with a small wire and then I plug in the board to the computer with a USB cable and press the RESET button. Isn't this the right way? How else am I supposed to do it?
One question. Is the number "1B4F" going to be the same irrespective of the bootloader version? As I mentioned earlier I am using the 0.2.9 version of the bootloader. Link provided in my very first post. BTW I also added this (see below) additional parameter in the file. The new line looks like this
I got the idproduct by typing lsusb in the terminal. Look the output of my lsusb in my previous post. Nothing changed. Every time I upload the code the board gets disconnected from the Arduino IDE and I cannot see the output of my code that is supposed to be printed on the serial port. Frustrating!
Thank you for the suggestion. I’ll try it out in a few hours.
Meanwhile I have a question. Where can I find the Sparkfun’s original bootloader for the Sparkfun Pro nrf52840 Mini board? The link on the Sparkfun page (https://github.com/adafruit/Adafruit_nRF52_Bootloader) is to the Adafruit nrf board’s bootlader. The one I have flashed on both of my boards (custom and Sparkfun Pro nrf52840 Mini) is specifically for the Adafruit nrf52 feather board. This is the link to the bootloader I have flashed (https://github.com/adafruit/Adafruit_nR … /tag/0.2.9). Does that make a difference?
PS - I am new to all this and my knowledge is limited. I appreciate all the help that I have been getting so far on this forum.
Nothing changed. Any other suggestions? Can someone point me to the proper bootloader version? I feel the bootloader is making the board appear as a USB dongle and is also responsible for the weird behavior I am noticing with my nrf boards.
I did not notice it last night but I could upload the code on the nrf board without it being detected as a USB drive (or in UF2 mode). This allowed me not to open the serial monitor first on the Arduino IDE and then upload the code. These steps resulted in a streaming array sensor readings on the serial port. Note this runs successfully only for the Sparkfun Pro nrf52840 board. Our custom boards have some issues with the USB serial port and I am in the process implementing alternatives. Anyway, all of this was entirely my PCs fault at the lab.
I started fresh on my home PC. I just followed the tutorial steps on the Sparkfun website (https://learn.sparkfun.com/tutorials/nr … cuitpython) and everything started working in two minutes. The board gets detected by the Arduino IDE instantly. I can upload the code, the board stays connected and I can stream the sensor data smoothly. The board does not randomly appear as a USB device anymore. It only appears when I double press the reset button. Note I also did not have to add any udev rules.