Reset Nano Every via 1200 Baud touch

I am trying to reset the nano every from remote.
I read about that I am suppose to be able to reset the nano every via a 1200 baud touch.

also mentioned in

I am expecting similar behavior as pushing the reset button locally, which means the board start with the setup()
But I don't seems get that working.

Unlike mentioned in the

I don't see reset at all, no matter connecting the serial through python or send the 1200 baud

The python script for the reset is kind of come from the post mentioned previously:

import serial
import time
com=serial.Serial(sys.argv[1],1200,dsrdtr=True)
com.dtr=True
com.write('0000'.encode())
time.sleep(2)
com.dtr=False
time.sleep(2)
com.close()

I am expecting the reset should be done via the updi pin, so I put scope on the updi pin but saw nothing when I run the script above.

Then I try to find where is the 1200 Baud goes, but I don't see it on the ATSAMD1114A.
On pin 21/22, I probe the test point at the back of the board, I saw bit flipping, the fastest at 5.6MHz
On pin 11/12, I probe the two pad of the R7, which is the 0 ohm resistor connecting TX_UPDI and RX_UPDI. I saw no change on both pins, and they both high.
On pin 15/16, I probe the two leds for the TX_D11 and RX_D11. I don't see bit flipping and both pins are high

Then I change the reset code baudrate to 9600

At the TX_D11, I saw the bits flipping, but the bit string at 9600 baud, with the high for ~104us. and low for ~104us.

So it seems that python script does not reset ATMEGA4809.
Then how can we use this 1200 Baud to reset the nano every?

Sorry, kind of typo as that is an additional step to set the baud rate to 9600 to verify my scope and TX_D11 probe are working correctly.

I modified the original post to avoid further confusion.

But I still don't have the 1200 baud and reset for the nano every :frowning:

@ghuang opened an issue about it in the arduino/ArduinoCore-megaavr repository:

You can see what the 1200 baud touch does here in the "MuxTO" firmware sketch that runs on the ATSAMD11 USB chip of the Nano Every:

Yes, I believe these two are the two side of the same coin.
From the nano every forum, I would like to see how other users get the reset works or not;
From the ArduinoCore-megaavr git repo side, I hope I can get one receipt to be able to compile/upload the firmware for the SAMD11D14A for the nano every, so I can understand more and hopefully modify the reset behavior to be reset on the 1200baud but not every time the serial port connection established.

BTW, I try to check the firmware version of my nano every by enable verbose output for the compile and upload in the preference.
I got
M_MCU:
boot-loader FW version: 1
firmware version: 6.00
hardware version: 1
S_MCU:
boot-loader FW version: 1
firmware version: 6.00
hardware version: 1

I could not see which tag in the firmware repo does it belong to, so I don't really know what firmware am I running. Is there any way to read more detail version or even git commit number from the binary?

We can handle that here.

There is a high level overview here:

https://www.arduino.cc/en/Guide/NANOEvery#firmware-for-samd11d14a

You can see the compilation process here:

https://github.com/arduino/ArduinoCore-megaavr/blob/master/.github/workflows/compile-muxto.yml

That is the configuration for the compilation of the firmware in the repository's CI system, so it is a bit cryptic. I can provide the equivalent instructions for the Arduino IDE if you like.

@in0 That would be great. Let's try it here.
I have read the first link on the getting started. I have installed MattairTech boards on my IDE

But according to the getting started, I am suppose to "be able to compile a basic firmware for the MuxTO", but I don't know exactly how to get that? It seems that repo is more of c programming instead of arduino, there are some in the different examples, but not for the overall project. I don't find a makefile can compile the thing easily either.

It would be great if you can provide the step by step instruction for the IDE compile and load the MuxTO.

Thanks

Let me start with the steps I have tried and the place I am stuck.
I am running a debian 11/arduino IDE 1.8.16
I have installed the Arduino mega AVR board, Arduino SAMD boards and MattairTEch AVR boards as shown in the previous post.

I have git clone the

and got the commit 4137a5.

cd ArduinoCore-megaavr/firmwares/MuxTO
arduino MuxTO.ino&

I have the IDE GUI with the .ino and the .h .c opened

Using the build options in tools:


I got the error below

/home/myname/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld: /tmp/arduino_build_517921/MuxTO.ino.elf section `.text' will not fit in region `FLASH'
/home/myname/.arduino15/packages/arduino/tools/arm-none-eabi-gcc/4.8.3-2014q1/bin/../lib/gcc/arm-none-eabi/4.8.3/../../../../arm-none-eabi/bin/ld: region `FLASH' overflowed by 744 bytes
collect2: error: ld returned 1 exit status
exit status 1
Error compiling for board Generic D11C14A.

Then I tried to checkout an older version by

git checkout ee0a9b

and repeat the compile step and got almost exact same error message.

OK, well it looks like you have things fairly well worked out, but I'll provide the instructions anyway for the benefit of others who are interested in the subject:

Install MuxTO boards platform

Since Arduino has not provided Boards Manager installation support, it is necessary to do a manual installation of the boards platform for the "MuxTO" chip:

  1. Select File > Preferences from the Arduino IDE menus.
  2. Take note of the path shown in the "Sketchbook location" field.
  3. Click the Cancel button.
  4. Run the following Git command:
    git clone --depth 1 https://github.com/arduino/ArduinoCore-samd -b muxto <Sketchbook location>/hardware/arduino-dev/samd/
    
    (where <Sketchbook location> is the path you learned from the Arduino IDE preferences in step 2)

Install toolchain

The manual installation of the "MuxTO" boards platform only provided the configuration files and core library. We also need the correct version of the compilation and upload toolchain. The easiest way to get that is by installing the equivalent boards platform via the Arduino Boards Manager:

  1. Select File > Preferences from the Arduino IDE menus.
  2. Add the following URL to the "Additional Boards Manager URLs field:
    https://www.mattairtech.com/software/arduino/package_MattairTech_index.json
    
    If you have other URLs in the field already, use a comma (,) separator.
  3. Click the OK button.
  4. Select Tools > Board > Boards Manager from the Arduino IDE menus.
  5. Wait for the updates to finish.
  6. Scroll down through the available boards platforms until you find "MattairTech SAM D|L|C core for Arduino by MattairTech LLC". Click on it.
  7. From the dropdown version menu, select "1.6.17".
  8. Click the Install button.
    (if you already have a different version of the platform installed, click the
  9. Wait for the installation to finish.
  10. Click the Close button.

Configure Arduino IDE

A comment in the MuxTO firmware sketch specifies the appropriate custom board options:

Compile with
fqbn=arduino:samd:muxto:float=default,config=enabled,clock=internal_usb,timer=timer_732Hz,bootloader=4kb,serial=two_uart,usb=cdc
to obtain the binary for Serial-to-USB converter + UPDI programmer on the Arduino Nano Every (MuxTO for brevity)
  1. Select Tools > Board > MattairTech SAM D|L|C core for Arduino by MattairTech LLC (in sketchbook) > Arduino MuxTO from the Arduino IDE menus.
  2. Select Tools > Floating Point > Print & String use auto-promoted doubles only from the Arduino IDE menus.
  3. Select Tools > Build Options > config.h enabled (mostly code size reductions) from the Arduino IDE menus.
  4. Select Tools > Clock Source > INTERNAL_USB_CALIBRATED_OSCILLATOR from the Arduino IDE menus.
  5. Select Tools > Timer PWM Frequency > 732.4Hz (16-bit) from the Arduino IDE menus.
  6. Select Tools > Bootloader Size > 4KB_BOOTLOADER from the Arduino IDE menus.
  7. Select Tools > Serial Config > TWO_UART_NO_WIRE_NO_SPI from the Arduino IDE menus.
  8. Select Tools > USB Config > CDC_ONLY from the Arduino IDE menus.

Open MuxTO firmware sketch

  1. Clone or download the arduino/ArduinoCore-megaavr repository to a convenient location on your computer.
  2. Select File > Open from the Arduino IDE menus.
  3. From your copy of the arduino/ArduinoCore-megaavr repository, select firmwares/MuxTO/MuxTO.ino
  4. Click the Open button.
    The "MuxTO" sketch will now open in the Arduino IDE. Note that this is a multi-file sketch. Each file is shown in the Arduino IDE as a tab.

You are now ready to compile and upload the MuxTO firmware sketch.

Compare your instruction and what I have here, the version MattairTech I have 1.6.18 beta
I have use the config.h disabled, you are using config.h enabled (mostly code size reductions)
Following your instruction, I can compile but when try to upload
I am still getting the error

And the beginning part of the upload bossac command looks like

The reason the older version is needed is because the MuxTO boards platform is a fork of the "MattairTech SAM D|L|C core for Arduino" boards platform (which, ironically, is a fork of the "Arduino SAMD (32-bits ARM Cortex-M0+) Boards" platform), and Arduino's fork is not up to date. So you must install the older version of "MattairTech SAM D|L|C core for Arduino" in order to get the toolchain version that was in use at the time Arduino made the fork.

This is a known issue:

Maybe you can help out with it.

I have noticed that issue in the repo about the Compiled MuxTo binary too large.

I am not confident to modify/try to work on the code that I have not been able to run on hardware.
Is that possible for me to dial back to some particular older commit of the ArduinoCore-megaavr, so at least I can go through the whole process, including load the firmware to the SAMD11D14 and get the reset working?

Even I go back to the beginning of this MuxTO folder at commit b575efa on May 28, 2019, I am still getting

What is the version I have on the board I purchased? How can I compile and upload that?

From the verbose message, the version message seems be
M_MCU:
boot-loader FW version: 1
firmware version: 6.00
hardware version: 1
S_MCU:
boot-loader FW version: 1
firmware version: 6.00
hardware version: 1

Try rolling back the MuxTO boards platform in <Sketchbook location>/hardware/arduino-dev/samd/ to the commit at that date also.

Still got the same error.
Now I have the
ArduinoCore-megaavr at ee0a9b Aug 2, 2019
the
ArduinoCore-samd at da5b34 also on Aug 2 2019
I got a bin file size of 12456
and try to load it give me oversize error

On the other hand, at

@facchinm attached his compiled bin from the same commit, but the file size is only 12220

I can use the bossac load the bin from that zip file, but I can not reproduce the same bin from source.

Should I use an older version of arduino IDE?

BTW, even after load the bin from @facchinm, I still can NOT reset the nano every using the script of 1200baud touch.

I tried more on this.
I removed all the contents in teh loop of the MuxTO.ino and replaced with a UDPI reset

UPDI::stcs(UPDI::reg::ASI_Reset_Request, UPDI::RESET_ON);
delay(10000);
UPDI::stcs(UPDI::reg::ASI_Reset_Request, UPDI::RESET_OFF);
delay(10000);

Same as line 157-159 in ArduinoCore-megaavr/MuxTO.ino at master · arduino/ArduinoCore-megaavr · GitHub

Then I probe the udpi pin on the nano every, I got waveform like

From the scope, I can measure each bit take about 4.4us, kind agree with the 230.4k setting in the UDPI_io::init. From left to write, I try to read
0 (st) 10101010 (sync 0x55, LSB first ) 011 (P S1 S2)
11 (?? don't care)
0 (St) 00010011 (0xC8 LSB first) 111 (P S1 S2)
11 (?? don't care)
0 (St) 10011010 (0x59 LSB first) 011 (P S1 S2)
111...
Besides the number of 1s between bytes I don't understand, or maybe that doesn't matter?
The bytes he is sending is for the reset: ASI_Reset_Request (0xc0+8) and RESET_ON (0x59) (30.5.7 of ATMEGA4809 datasheet)

By reading the datasheet, I can see the SAMD11D14 is sending UPDI reset to the ATMEGA4809.
But apparently, the setup() code in the arduino doesn't run.
I will try to readback the status to see if the setup successful or not.

Try to read back from updi using the lcds function in the UPDI_lo_lvl.h ( I think that is a typo in the repo, it should be ldcs)
mode = UPDI::ldcs(UPDI::reg::Status_A);
doesn't give me response.
It is stuck after sending the 0x80
I can see the 0x55 and 0x80 on the scope but no response from ATMEGA4809.
And the code stuck at the while loop in the UPDI_io::get(), because the Serial2 have nothing available.

My guess is the UPDI enable step (as shown in ATmega4809 datasheet 30.3.2.1 ) is not successfully.
I can question on the updi_io.cpp vs. updi_io_soft.cpp.
Before I dive into more detail of the UPDI, I still hope to have a basic functional version to start with so I don't have to reinvent the wheel.

Currently I am not able to compile a working version for any of this git repo makes me nervous. Maybe some of the environment is not setup correctly?

Learn from the JTAG2.cpp, I realized the code using the break to do the UPDI enable step.
After add that before the two UPDI::stcs, I can reset the ATMEGA4809 now.

But I do not have a functional version of the firmware from the source.
The version I have can not upload sketch to the ATMega4809:(
Got error:
avrdude: jtagmkII_getsync(): sign-on command: status -1
avrdude: jtagmkII_getsync(): sign-on command: status -1
Check UPDI pin on scope got lots of pulses, too many for me to intemperate by eyes.

Hi I did all these steps, then pressed the upload button. It said it could not find a board on the port. I cannot select a port since it is grayed out. I am using an Atmel-ICE to upload the firmware. Note: there is no firmware on my SAMD11 chip. Would appreciate if someone could guide me. Thanks!

Hi @egeozgul. Try selecting Sketch > Upload Using Programmer from the Arduino IDE menus instead of using a normal "Upload" operation.

Thanks for the reply. I got the following error. I would appreciate if someone could help me with the following error:
(I can upload an empty sketch though, so my board is definitely connected!)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.