Hello guys, please I beg you help me.
Here's the situation: I've developed some code and thoroughly debugged it on a breadboard. The code has been running smoothly on a XIAO SAMD21 board, and everything was working perfectly. However, I've encountered a snag—I've run out of pins and needed to incorporate an accelerometer into my circuit. I thought that by purchasing the NRF52840 Sense board, I could utilize its onboard accelerometer. So, I acquired the board, uploaded my code to it, and unfortunately, it's not working as expected.
The NRF board operates flawlessly with all the example codes; there are no issues even with a customized code that toggles all the pins on and off. However, as soon as I upload my code, it malfunctions. Specifically, incorrect pins are activated, some don't function at all, the serial connection between the board and my PC is lost, and it becomes nearly impossible to upload any further code to the board. I have to force the board into bootloader mode by pressing the reset button twice to, for example, load the Blink example code onto the board. Once this is done, the board operates perfectly again. However, if I upload my code again, the same issues arise. It's important to note that at this point, the board isn't connected to the breadboard, and all the pins are unconnected—it's solely powered by the USB cable connected to my PC.
I have already tried changing which pins are used in the code, but that didn't change anything. Additionally, I have attempted to remove the interrupts, but that didn't help either.
Is it possible that my code is causing such significant issues with this board? I'm a complete amateur at this, so I'd greatly appreciate your help in figuring this out. Please bear with me and my potentially flawed code.
Thank you in advance for any assistance you can provide!
The error message i get after the board is broke is here:
*Failed to upgrade target. Error is: Write timeout
- 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 206, in _dfu_send_image*
-
- File "nordicsemi\dfu\dfu_transport_serial.py", line 213, in send_firmware*
-
- File "nordicsemi\dfu\dfu_transport_serial.py", line 241, in send_packet*
-
- File "site-packages\serial\serialwin32.py", line 323, in write*
- serial.serialutil.SerialTimeoutException: Write timeout
*> * - 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.
Here is my code for referance.
BROKEN_CODE.ino (18.8 KB)