-
-
Notifications
You must be signed in to change notification settings - Fork 64
Serial interface locks up on Nano Every #51
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
Comments
Hi @technoblogy , thanks for reporting. I investigated the problem and indeed it lies in the USB stack for the D11 (muxto). Could you follow the guide at https://www.arduino.cc/en/Guide/NANOEvery (Firmware for SAMD11D14A chapter), trigger the D11 bootloader, extract the attached zip and execute this command? |
Thanks for the reply - I'll try upgrading my firmware. |
@facchinm I'm struggling with this. Do I have to install the MattairTech core? Do I need to solder a link between the D11 SWDIO and GND pins? Where should I give the command:
When I do it in the Mac Terminal I just get:
|
Hi @technoblogy ,
|
Still not working. I plugged in the board with the SWDIO pin connected to ground. The instructions say:
Where will that appear? I'm getting:
|
OK, I've worked it out. The Serial Monitor says /dev/cu.usbmodem1411, but if I do:
I get:
So I tried:
and that worked. Note that I didn't need to run |
I confirm that the muxto bootloader 1.0.6 fixes the serial problem I reported - many thanks! One final question. I was thinking of specifying the Nano Every board to users for an application I've developed, but for my application this problem makes the board unusable, and I don't think they will all be able to do this upgrade. How many boards have shipped with the pre-1.0.6 bootloader? Will it be corrected in future boards, and will there be a way of telling which version you've got? Thanks, David |
Thanks for getting back! The next batch will be flashed with 1.0.6 but there's very little chance to be able to reflash the boards currently in the market (except the ones we still have "in house"). About reflashing, the procedure you followed is the most complicated (but doesn't need any additional hardware). Any 10$ SWD programmer can reflash the D11 using the same pins on the bottom and is much faster (if you need to do it more than once). Finding the MuxTO version flashed on a board is not easy at all, we had to strip a lot of information to fit the firmware in 12KB, but we can trace back the fw that was originally flashed using the board's serial number. |
I think that would be useful, so we can say "if your serial number is later than xxx you don't need to do this". |
It's a bit more complicated since serial numbers are not consecutive, so we need to query the boards DB to get that information 😑 |
Here's a summary of the procedure that worked for me on a Mac, in case it's useful for anyone else:
This should print a list of ports; something like:
The one you want is the usbmodem one.
substituting the port printed in the previous command. If all is well you should see the upgrade information printed by the Bossac installer. When that's finished you can unplug the board, and then plug it back in to use it with the new bootloader. |
I now have a different problem; detecting whether the Serial is ready. With this simple test:
I get nothing printed unless I insert a delay:
The usual test for whether the Serial is ready is:
However, on Nano Every it appears that Serial returns true even when the serial isn't ready, because if I do:
I again get nothing printed. |
Although MuxTO 1.0.6 is a big improvement over the version that was originally installed on my Nano Every, unfortunately there is still corruption occurring in the serial interface. You can demonstrate this as follows:
The output looks like this; the red circles show the dropped characters. 29th August 2019: Updated screenshot to show additional dropped characters. |
Is there any Windows driver for the MuxTo mode? Or do I need to find a Mac to update the firmware? |
@technoblogy about the Same space issue for holes in transmission, samd11 RAM is not enough to have big buffers, so even if all the data is flushed it still takes the "9600bps-specific" amount of time to deliver it, and the serial starts dropping characters. @hiduino you can use the exact same package for windows, simply replace |
@facchinm, thank you, that version of bossac worked on Windows with the Nano Every! Side note: I had to make an extra entry in the arduino-samd.inf file to add the VID/PID for the MuxTo bootloader so that Windows could add the serial COM port entry. |
@facchinm this makes the serial unusable for many applications. Is there any way of fixing this? The SAMD11 has up to 16Kbytes of SRAM - surely that's enough for buffers? |
@technoblogy it has 16KB of flash and 4KB of RAM, the USB buffers can still be enlarged a bit but not that much |
I repeated your stress test too with the firmware from #52 and it doesn't lose any character. If you could retest in your environment and report back it would be great. |
OK, I'll test it - thanks! |
@facchinm now that we got an early alpha version of Optiboot running on ATmega4809, would it be possible/make sense (in the future) to turn the SAMD11 into a dedicated USB to serial adapter instead, and not having to use the UPDI interface for programming? Maybe just change the USB PID so it would be able to identify it? |
@MCUdude makes sense, but the procedure would be a bit convoluted (we need to burn optiboot using the UPDI layer BEFORE updating the D11, a bit error prone 🙂 ) EDIT: if you meant on new boards, it TOTALLY makes sense |
Yes, doing so for old boards would not make sense, I meant new boards. What's awesome about this is that it would now be possible to use avrdude directly, since the 1200bps touch is difficult to perform outside Arduino IDE. If you went for a 5V compatible USB to serial adapters, like the 8u2/16u2 you can also get rid of all level shifting too. EDIT: |
Observations from testing firmware from #52, it seems to only work right after an IDE Upload. If you unplug and re-plug the USB then it appears the UPDI doesn't reset the 4809. Also it still appears to lockup after 7 or 8 of the large buffer inputs. |
@hiduino can you provide a test case for the large buffers lockup? If you unplug and replug the usb without externally powering the board the 4809 obviously resets 🙂 EDIT: I reproduced the large buffers issue and patched it in the same PR. If you could test it independently it would be great. |
@facchinm , Yes, that seems to correct the large buffer lockup issue now. To clarify, for the board reset, it doesn't seem to work from the IDE Serial Monitor invoke after you unplug/replug the board back in. The UPDI reset only seem to work after a fresh Upload. Could it be the state of UPDI after a replug in? If I close and re-open the Serial Monitor should it not cause the UPDI reset? It doesn't after a USB unplug/replug. |
@hiduino got it, I've been able to reproduce and I'm taking a look immediately, thanks! EDIT: pushed a new commit & firmware that solves the issue, thanks again for the report. |
@facchinm do I just need to upload a new MuxTO to the board? If so, could you give me a download link for it? |
@facchinm , Okay, looks like the UPDI reset works correctly now after an unplug/re-plug of the USB. Edit: Tested on 4 different Nano Every boards, all work great. |
@technoblogy , you can go to the pull request #52 page and open up the Files changed tab, then view file to download the MuxTo.bin file. |
@facchinm I've uploaded the latest MuxTO.bin file to my Arduino Nano Every. I can't find any version number to identify it, but it has a modification date of 12 Sept 2019. Unfortunately I can't detect any improvement - there is still corruption occurring in the serial interface. My demonstration program earlier in this post gives exactly the same sorts of dropped characters. Should it have improved these? |
@technoblogy to identify the new version just upload a sketch with verbose on and you should see these lines.
This firmware fixes your test case for me, with no dropped characters |
@technoblogy , I've also tested the latest MuxTo and did not experience any drop characters. I've tried copying over 20 times of the large buffer test and no drop characters observed. I'm testing on two different Windows 7 Pro platforms using Serial Monitor from the IDE. Have you try testing with different USB cables or on different systems? |
I'll try when I get home at lunchtime. |
I get this:
You said:
I couldn't find a MuxTO.bin file download link on that page so I downloaded the whole ArduinoCore-megaavr project and located the MuxTO.bin file in the MuxTO folder, which had the date 12 Sept 2019. |
@technoblogy you did the right thing but it looks like the firmware didn't update properly. Are you sure you are flashing the right .bin? Make sure you remove the one I sent you at the beginning in the zip. |
I've tried again. This is what I get in the terminal:
but when I upload a sketch from the Arduino IDE I still get:
Please can you give me a direct link to the correct MuxTO.bin file. |
The update should read
The new firmware is 12288 bytes long; try redownloading using this link https://github.com/arduino/ArduinoCore-megaavr/raw/master/firmwares/MuxTO/MuxTO.bin |
Please can you reopen this issue as it isn't solved. Also, I think it should stay open even when it is solved, so users who have received the boards with MuxTO prior to 1.0.6 can find out how to upgrade. |
I updated the firmware in SAMD11 too. I am on Linux. Important is to use bossac version 1.7.0-mattairtech-3 installed with MattairTech_Arduino SAMD 1.6.17. The bossac installed with Arduino SAMD and older MattairTech versions report unknown device. The boards package JSON for MattairTech_Arduino SAMD is hard to find in the middle of the README so here it is: the latest firmware bin is here https://github.com/arduino/ArduinoCore-megaavr/tree/master/firmwares/MuxTO |
On a Nano Every, if you try and transfer more than about 128 characters from the Serial Monitor to the board via the serial interface it locks up, and the only solution is to unplug the USB cable.
The following program demonstrates the problem:
Open the Serial Monitor, copy a line of text of 128 characters, paste it into the input field, and click Send.
I'm running Arduino IDE 1.8.9 on a Mac, and the Arduino megaAVR Boards file version 1.8.3.
It works fine on a Uno WiFi Rev 2.
The text was updated successfully, but these errors were encountered: