zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.66k stars 6.52k forks source link

JEDEC SPI-NOR Sample broke the JLink detection: nRF52840DK does not show up on computer anymore #58279

Closed electrocnic closed 1 year ago

electrocnic commented 1 year ago

Finally we figured out that the UART interface of the nRF52840 is still sending the test logging output from the code sample when we switch the board from off to on, with a USB to UART dongle connected to the testing point TP2. This is our hint that this flash operation on the eval kit's QSPI flash memory somehow interrupts the booting process directly at startup.

  1. The swithches are set to on, VDD, and default. The nrf5340 DK have another switches VEXT -> nRF and FLOW CONTROL which set to OFF and ON.
  2. Micro USB was connected on short side.
  3. Device manager did not show up anything when DK connected or disconnected.
    1. The USB cable can use on another nrf52832 DK. So, I think USB cable is no problem. And it worked until I used this specific sample program.
    2. DK cannot config on two different PCs
    3. We have measured the power. Both VDD(3V) and 5V are working normally. Also the nRF5340 internal regulators seems to be OK.
    4. Have you tried to press the IF BOOT/RESET button while power cycling the kit? It should then show up as a Removable Storage Device named "BOOTLOADER". Then you can drag-and-drop the J-LINK interface MCU firmware found here (v170724) onto the storage device to reprogram the JLINK firmware. Yes, we have tried that with no success: There is no LED responding to this button whatsoever and the computers still did not recognize the device.
  4. USB Data lines of J2 (leading to the nRF5340) stays on GND on the oscilloscope, nothing visible there.
  5. The oscillator crystal connected to the nRF5340 chip seems to work because we could measure a 32MHz sine using a oscilloscope.
  6. We measured the voltages at the nRF5340 as shown in the image below: 3V at VDD, around 1.16V and 1.05V at the A27 DECR and A15 DECD pins, correspondingly (see red voltage labels in the image by added by us) image

The board is a nRF52840DK revision 3.0.0 I built and ran the sample on a Ubuntu 22.04 computer using Visual Studio code with the nRF connect extension.

This is the output of the nRF52840DK at TP2 which we can be seen immediately after we turn the power switch to ON on the UART terminal on on uart<->USB dongle:

*** Booting Zephyr OS build v3.2.99-ncs2 ***

mx25r6435f@0 SPI flash testing
==========================

Test 1: Flash erase
Flash erase succeeded!

Test 2: Flash write
Attempting to write 4 bytes
Data read matches data written. Good!!

However, as explained above, that is it: LED5 is off after just a blink and stays off and the board is NOT recognized by two different computers, so I cannot even reprogram it using the nRF Connect Programmer. VS Code does also not recognize it, neither does lsusb on linux or the Device Manager on Windows show the nRF DK board. Without the dongle we would not be able to attach an nRF Serial Terminal to monitor the UART output. Also, again: I used this board for 2 days without a problem and successfully tried the UART Bluetooth example and could send a bluetooth message to my Android phone. I re-programmed the board several times, and even was able to debug it with breakpoints. Only when I used this spi flash example it stopped working. What can we do to restore the board?

github-actions[bot] commented 1 year ago

Hi @electrocnic! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

nordicjm commented 1 year ago

There may be a fault with the board but I don't think it would be a specific zephyr sample that caused it. And out of interest, why are you using zephyr 2.3?

nordicjm commented 1 year ago

@tmon-nordic I assume this is the voltage follower drop issue?

electrocnic commented 1 year ago

And out of interest, why are you using zephyr 2.3?

I am sorry, I did not copy the UART output from our actual terminal but from the github page of the sample. I fixed that now and got our real output instead. We are using v3.2.99-ncs2.

Thanks for your quick reply!

tmon-nordic commented 1 year ago

@tmon-nordic I assume this is the voltage follower drop issue?

I don't think so. The switch is in the VDD position, where for the drops to occur (see https://github.com/zephyrproject-rtos/zephyr/issues/57735#issuecomment-1545234754) I had to power nRF from USB.

@electrocnic I understand that the issue you see is with the JLink itself. That is, the problem is that JLink is not recognized at all and therefore you cannot flash new software? And just to make sure there is no obvious problem, you connect the microUSB connector on the narrow edge (the one closer to the ON/OFF switch)?

electrocnic commented 1 year ago

@electrocnic I understand that the issue you see is with the JLink itself. That is, the problem is that JLink is not recognized at all and therefore you cannot flash new software? And just to make sure there is no obvious problem, you connect the microUSB connector on the narrow edge (the one closer to the ON/OFF switch)?

that is correct.

tmon-nordic commented 1 year ago

Have you tried to press the IF BOOT/RESET button while power cycling the kit? It should then show up as a Removable Storage Device named "BOOTLOADER". Then you can drag-and-drop the J-LINK interface MCU firmware found here (v170724) onto the storage device to reprogram the JLINK firmware. Yes, we have tried that with no success: There is no LED responding to this button whatsoever and the computers still did not recognize the device.

Did you copy that from old devzone question? Note that the J-LINK interface MCU firmware v170724 is for older DK version that didn't use nRF5340 for JLinkOB but did use SAM3U128. I hope you didn't flash SAM firmware to nRF52840 JLinkOB.

I am unable to reproduce the issue on nRF52840DK PCA10056 3.0.0 2022.34. The problem is not with Zephyr and therefore this is not the correct place to ask for help. Please open ticket at Nordic Devzone so Nordic technical support can help you.

Note that the Interface MCU (nRF5340 running JLinkOB) is pretty much independent form the nRF52840. I don't think any software running on NRF52840 can prevent JLinkOB from working. You can try to force nRF52840 to reset, e.g. by shorting the reset pin on Debug In P18 to rule out nRF52840 influence completely.

The swithches are set to on, VDD, and default

I would wiggle the switches (when disconnected) back and forth and make sure they end up on the correct positions. For example if the nRF ONLY|DEFAULT switch is in nRF ONLY position then JLinkOB won't work. The switches have to be as you described, i.e.:

carlescufi commented 1 year ago

Please use the Nordic Devzone for this issue, as it has nothing to do with Zephyr itself.

electrocnic commented 1 year ago

Did you copy that from old devzone question? Note that the J-LINK interface MCU firmware v170724 is for older DK version that didn't use nRF5340 for JLinkOB but did use SAM3U128. I hope you didn't flash SAM firmware to nRF52840 JLinkOB.

Yes, those questions provided a nice debug path to follow so we could rule out basic things. And no, I did not flash that specific firmware.

I am unable to reproduce the issue on nRF52840DK PCA10056 3.0.0 2022.34. The problem is not with Zephyr and therefore this is not the correct place to ask for help. Please open ticket at Nordic Devzone so Nordic technical support can help you.

Ok, will do that eventually. Thanks for your effort! This really helps to rule out the Sample Code to be the issue and I suppose it is indeed rather a hardware issue in our case. Thank you!

Note that the Interface MCU (nRF5340 running JLinkOB) is pretty much independent form the nRF52840. I don't think any software running on NRF52840 can prevent JLinkOB from working. You can try to force nRF52840 to reset, e.g. by shorting the reset pin on Debug In P18 to rule out nRF52840 influence completely.

Thanks for this hint.

I would wiggle the switches (when disconnected) back and forth and make sure they end up on the correct positions. For example if the nRF ONLY|DEFAULT switch is in nRF ONLY position then JLinkOB won't work. The switches have to be as you described, i.e.:

  • nRF ONLY|DEFAULT -> DEFAULT
  • nRF Power Source Li-Po VDD USB -> VDD
  • Power ON OFF -> ON

That we will also try again (however, we did these things anyways :D )

Anyways, thanks again for all your help. Really appreciated!