This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Loss of USB connection after flashing Zephyr image

Hello!

I'd like to briefly introduce what I'm attempting to do: I'm trying to flash some samples from the Zephyr project into a custom board. The custom board is based on the RAK5010 which is supported by the project and uses nRF52840 as the chipset.

I am capable of building the samples from Zephyr and can see them work on the nRF52840-DK. So regarding setup for compiling and flashing, I believe I'm with the right setup.

The issue that I'm seeing is that when flashing a sample to the custom board, I'm "losing" connection with the USB.

For instance, this is what I have before flashing the "hello world" example:


======================================================
$ ls /dev | grep ttyACM
ttyACM0
ttyACM1
$ ls /dev | grep ttyUSB
$
======================================================

As you can see, there are 2 devices connected: ACM0 is the microusb connection with the board, while ACM1 is the connection done via JTAG.

I cannot flash to the custom board directly without a JTAG, as the tool isn't capable of seeing the board with the nrfjprog --ids command.
However, using the JTAG I can flash and the flash is sucessfull as can be seen in the following logs:

======================================================
Flash output
======================================================
$ west flash --erase
-- west flash: rebuilding
ninja: no work to do.
-- west flash: using runner nrfjprog
-- runners.nrfjprog: mass erase requested
Using board 59400959
-- runners.nrfjprog: Flashing file: /home/rys/Documents/repositorios/poc_nrf52840/zephyr/build/zephyr/zephyr.hex
Parsing image file.
Erasing user available code and UICR flash areas.
Applying system reset.
Checking that the area to write is not protected.
Programming device.
Enabling pin reset.
Applying pin reset.
-- runners.nrfjprog: Board with serial number 59400959 flashed successfully.
======================================================
Now even though the board has been successfully flashed, I cannot check the logs or anything like that as the device is no longer listed:

======================================================
$ ls /dev | grep ttyACM
ttyACM1
======================================================
As can be seen above, only the connection with the JTAG is detected.
As for what I've tried so far: I checked the device tree file and the pin declaration is matching what I have on the board.
I also tried to flash without the JTAG, but the board is never recognized by the nrfjprog tool during "west flash".
Finally, I tried flashing the blinky sample on the board to see if, at least, I could see the LED blink. If so, then I would know that at least the code is running on the board.
However, even though I'm capable of compiling and flashing successfully to the board (at least according to the logs), I cannot see the LED blink.
Do you have any ideas on how I could proceed into debbuging this matter?
Thanks!
Renato
  • Hello Renato, 

    ======================================================
    $ ls /dev | grep ttyACM
    ttyACM0
    ttyACM1
    $ ls /dev | grep ttyUSB
    $
    ======================================================

    What application firmware was loaded to the RAK5010 before you flashed the Hello World example? Do you have access to the code and its configuration?

    Since I do not have any experiences with this board, I have to do qualified guessing now ;-) But I hope it will help you somehow:

    What I can see in the zephyr.dts when building the hello world application for this board, is that UART1 is used for console logging:

    chosen {
    		zephyr,entropy = &cryptocell;
    		zephyr,flash-controller = &flash_controller;
    		zephyr,console = &uart1;
    		zephyr,shell-uart = &uart1;
    		zephyr,uart-mcumgr = &uart1;
    		zephyr,bt-mon-uart = &uart1;
    		zephyr,bt-c2h-uart = &uart1;
    		zephyr,sram = &sram0;
    		zephyr,flash = &flash0;
    		zephyr,code-partition = &slot0_partition;
    	};

    Which UART is the USB connected to on this/your board? Otherwise, UART0 has enabled quectel_bg9x, which I guess is a modem driver? You might wanna disable it using an overlay file and see if that makes any difference?

    uart0: uart@40002000 {
    			reg = < 0x40002000 0x1000 >;
    			interrupts = < 0x2 0x1 >;
    			status = "okay";
    			label = "UART_0";
    			compatible = "nordic,nrf-uart";
    			current-speed = < 0x1c200 >;
    			tx-pin = < 0x6 >;
    			rx-pin = < 0x8 >;
    			rts-pin = < 0x7 >;
    			cts-pin = < 0xb >;
    			quectel_bg9x: quectel_bg9x {
    				compatible = "quectel,bg9x";
    				label = "quectel,bg9x";
    				mdm-power-gpios = < &gpio0 0x2 0x1 >;
    				mdm-reset-gpios = < &gpio0 0x1c 0x1 >;
    				mdm-dtr-gpios = < &gpio0 0x1a 0x1 >;
    				mdm-wdisable-gpios = < &gpio0 0x1d 0x1 >;
    				status = "okay";
    			};
    		};

    Regards,

    Markus

  • Hi Markus,

    Thanks for the reply. I'm using a pre-built firmware of micropython to this board. The time when I'm capable of seeing the entry as ACM0 is when I use that build.

    Regarding your suggestion, I'll give it a try as soon as possible and get back in touch.

    Thank you!

    Renato

  • Hi Markus,

    I made some tests here based on your suggestion.
    So I created the overlay that your provided, I had to adjust some parts such as removing the address uart@40002000 from the declaration as it was failing the build. I also disabled bg96, which as you said in the first comment, is related to the modem.

    I was then able to compile and flash the blinky sample successfully, but still coudn't see the device being recognized at /dev. I tried plugging and unplugging the microusb to see if there was any event being sent to dmesg but that didn't happened either. Nor could I see the LED blink.

    I double checked the pins from the board, the LED pin and the other ones seem to be matching but I saw a slight difference related to the declaration from TX/RX at uart1.

    From the dts file, uart1 declares pins tx/rx as 33/34 but on my custom board they should be set to P1.05/06 (which I believe is 0x25/0x26).

    So I tried creating an overlay with that change and still nothing.

    Do you have any other ideas on how I could proceed to debug this matter?

    Thanks!

  • Hello Renato,

    rys said:
    So I created the overlay that your provided, I had to adjust some parts such as removing the address uart@40002000 from the declaration as it was failing the build. I also disabled bg96, which as you said in the first comment, is related to the modem.

    I’m very sorry for being unclear, but the snippet I provided actually was from the original zephyr.dts, which is automatically generated from the devicetree in ../build/zephyr during compilation.

    Do you have an RAK5010 board available? What happens if you flash the "hello world" application to the device? Does this work or do you get the same issue? I’m asking since I’m thinking it would make sense to find out if this is a software or hardware related issue. 

    rys said:
    So I tried creating an overlay with that change and still nothing.

    Have you checked ../build/zephyr/zephyr.dts after re-building? This is a good way to confirm that the modifications you have made in the overlay file actually are considered.

    Regards,

    Markus

Related