-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standard output is truncated and sent to the shell input on Arduino Nano 33 BLE for the default example #20544
Comments
Thanks for the report and sorry for the long wait. I believe the issue you have faced is that two instances of Could you give this another spin? Ideally use the default terminal (pyterm), by not specifying If you can still reproduce the issue could you try to capture the USB traffic e.g. using WireShark and confirm that the chars are already missing in the data send to the host? |
I've tried picocom and pyterm, both are giving me same result. I never used Wireshark to debug USB communication but it seems that the packets sent on both side have the same problem as those I get when using the serial terminal. From what I understand, the characters that are printed before the shell is executed seems to be partially redirected to its input. Using my previous example : |
Here's a zip containing the Wireshark capture of the problem in the file named I also included a typescript of terminal session so you can see exactly what happened, you can replay the script using : The zip file : trace_and_script_33_ble.zip |
@maribu |
Thx for the follow up. Sadly, I won't be able to look into this issue any further due to time constraints 😦 |
It is very odd that only the Arduino Nano 33 BLE would be affected. My suspicion was that it might be related to the bootloader, so I flashed the Arduino Nano 33 BLE bootloader to one of my nRF52840DK boards and tested it. To flash the bootloader you have to download the "bootloader.bin" file from here: https://github.com/arduino/ArduinoCore-mbed/tree/main/bootloaders/nano33ble Then I used nrfjprog to program the nRF52840 with the J-Link:
Unfortunately this is the output I got from the nRF52840 on the "nRF USB" port;
So I would like you to try to flash the Arduino Nano 33 BLE bootloader to one of your other nRF52840 boards as well and see if it works or not. Unfortunately I don't have an Arduino Nano 33 BLE and I don't have an old revision of the nRF52840 either. Maybe @maribu can do the same test that I did, it takes only a couple of minutes with one of his old boards. Edit... I just saw that I did the test with my development fork, but that only has changes regarding the mtd_spi_nor subsystem, that shouldn't have any influence compared to the mainline code. |
I also noticed that the bad behavior was not happening consistently, sometimes (I think the first time I flashed a new firmware) the observed behavior was correct exactly as you mentionned. |
Can you try using FEATURES_PROVIDED += tinyusb_device
USEPKG += tinyusb you can confirm the change by doing: $ make BOARD=arduino-nano-33-ble info-modules | grep usb
auto_init_tinyusb
periph_init_usbdev_clk
periph_usbdev_clk
stdio_tinyusb_cdc_acm # <------- look for this line
tinyusb_class_cdc
tinyusb_common
tinyusb_contrib
tinyusb_device
tinyusb_hw
tinyusb_portable_nrf5x |
@Enoch247 your solution seems to "fix" the problem in a way as I don't have garbage anymore when I type a command but I still don't have the two first lines (This is RIOT and the other one) and also when I try to flash again my board, bossac is telling me "Device unsupported". It means that I have to manually press the reset button to put it back in flash mode. For the initial problem, given the results, I suppose that the problem is coming from the usual usb stack that might be too slow for this particular board type. |
RIOT defines custom VID/PID for using USB. We do this only for convenience. In theory, user should provide its own VID/PID couple. You could check the VID/PID for |
I looked at the VID/PID in both See : For tinyusb :
And I guess there for usbus (not 100% sure on this one tho) : RIOT/sys/usb/usbus/usbus_fmt.c Line 290 in 436b6ed
|
Yes, lsusb confirms that too: For periph_usb:
For tinyusb:
These are the bossac outputs when you enable the -d option for "debug":
Then I reflashed the Arduino Bootloader (because I couldn't get it to program with the Reset button on the nRF52840DK) and this is the output from bossac:
So what's happening here is that bossac tries to read a version (which I don't know yet how it does it) and the tinyusb program does not answer that correctly, therefore bossac can not identify the board and the operation fails. |
Arduino bootloader probably have a different VID/PID couple. |
The defaule example compiled with tinyusb indeed does not seem to go into bootloader mode. When bossac is called, it should make the program go into bootloader mode. This should automatically change the VID/PID and the terminal shouldn't be accessible, which it is. When there's a blank Arduino bootloader flashed and nothing else, the device has these IDs:
With the periph_usb default example flashed and bossac is doing an upload, the device has the 2341:005a ID during the upload as well. |
So you're probably missing |
That was the problem I think, adding this module fixed this issue on my side. Thank you for the solution, as I already looked a bit at how bossac is used within RIOT I knew there was something odd about the reset not being triggered automatically but was not sure how to make it work the right way. Also, does this means that tinyusb is missing the Unfortunately as I mentionned it does not solve entirely the problem as the first two lines that should be printed when RIOT is starting are not. |
I can confirm it works now. In the previous comment, I did not call the Also I can confirm that the output right after flashing is missing (but not truncated). |
Alright we're making some progress here :) |
Out of the scope of this issue, just a side note. You can also use |
@dylad I tried to modify the TERM_DELAY in a range of 1 to 10 and i had no success with our issue. |
I don't have much idea for the remaining issue and I don't think I still have a nRF52-based board around. |
I have absolutely no idea, for me nRF53 and nRF52- are two different types of chip and I don't think you can have compatibility between the two easily. I don't have myself a nRF53 board so I will not be able to help you there. |
The issue seems to be present on SAM21G microcontrollers as well: #20305 |
Description
The default example is supposed to print two lines then let the user type the commands, but on the Nano 33 BLE the two lines are not printed correctly and some characters are mixed in the shell input which imply that the user has to erase them.
Steps to reproduce the issue
With a Nano 33 BLE linked to the computer :
Note that I'm using picocom instead of pyserial which doesn't change anything to the result.
Expected results
The output is clean with the lines printed in the right order and the input is empty and let the user type his command without erasing anything.
The output is supposed to be the following one :
Actual results
The actual output is :
The first line is not printed and instead seems to be partially sent to the input of the shell.
Versions
All tests performed on a fresh master branch.
Operating System Environment
Operating System: "Ubuntu" "22.04.4 LTS (Jammy Jellyfish)"
Kernel: Linux 6.5.0-26-generic x86_64 x86_64
System shell: /usr/bin/dash (probably dash)
make's shell: /usr/bin/dash (probably dash)
Installed compiler toolchains
native gcc: gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
arm-none-eabi-gcc: arm-none-eabi-gcc (15:10.3-2021.07-4) 10.3.1 20210621 (release)
clang: Ubuntu clang version 14.0.0-1ubuntu1.1
Installed compiler libs
arm-none-eabi-newlib: "3.3.0"
Installed development tools
cmake: cmake version 3.22.1
doxygen: 1.9.1
git: git version 2.34.1
make: GNU Make 4.3
openocd: Open On-Chip Debugger 0.11.0
python: Python 3.12.2
python3: Python 3.12.2
The text was updated successfully, but these errors were encountered: