Is it possible to reprogram the USERROW without resetting the processor ? Some of the Microchip bumpf seems to imply you can, but the datasheet says to write to the UPDI.ASI_RESET_REQ register to force a system reset. I was hoping to change the USERROW data whilst the system was still running. I can't actually test this myself yet as I'm still designing the PCB.
Programming the USERROW without resetting the processor ?
The datasheet does imply that you can use the NVM controller via UPDI without using the "proper" sequence, that is, without a reset.
I never tested it, but I can do it when I have the time (might take a couple of days).
Thanks - that would be great. I'd rather just configure the slave processor over UPDI than have it running a complete serial programming stack just to receive some config bytes every now and then. But I can't have it stopping
About a year ago, I wrote a program that could write the I/O ports via the UPDI interface, just a small blink program, while the MCU was running, completely oblivious to the fact that the pin was being controlled from the outside.
So, if the NVM I/O space is also writable, it will be possible to do what you want. That's what I will check.
I've completed my tests. My conclusions:
- It's not possible to use the NVM from the UPDI without a reset, even if you write the NVM activation key.
- The reset puts the CPU in some kind of suspended state where the NVM can be used.
- Outside of this special mode, any attempt to use the NVM from the UPDI results in an UPDI error.
- Therefore you can't write the user row without issuing a reset.
- Without reset, you can only write memory addresses that do not need the NVM (I/O registers and SRAM). These can be written directly from the UPDI.
Many thanks for trying this. Saved me finding it out it doesn't work once the PCB has been made, and I expect others will wonder if this would work so now there's a definitive answer published.
I'll have to set up a serial link and parse the data myself which might mean upping the on-chip memory.
Thanks again
Mike
Oh hang on, reading your post again. Are you saying I can write directly to the variable RAM ? I assumed that wouldn't be possible which is why I was thinking of using the USERROW. But I could implement a simple lock mechanism to stop the on-chip program trying to use variables whilst they are in the process of being overwritten by the master processor.
Yes, the SRAM can be written while the CPU is running, and also the peripheral registers, except for the NVM.
Ah that is very good news !! I'll have to read the UPDI specs to see how to do it but good to hear it works
Mike
Here are some open source examples on how to interface with UPDI, they might be useful to you, since the datasheet is not always 100% clear:
https://github.com/ElTangas/jtag... (yeah, I wrote this one and used a simplified version for the tests I did - language C++)
https://github.com/mraardvark/py... (written by Atmel staff - language Python)
Yes those are the ones I already have in front of me :-)
And yours is by far the most useful. I really wish somebody would explain to these people that application software needs to be written in C++ so it can be easily incorporated in larger projects on multiple targets. I can't install a Python or Java system on a ESP8266 for example.
Thanks for all your efforts !
I can't install a Python or Java system on a ESP8266 for example.
Programming Microcontrollers with MicroPython | DigiKey
by Jacob Beningo
...
2017-09-07
...
The ESP8266 folder contains support for Adafruit’s Huzzah break-out board for the ESP8266 and Feather Huzzah Stack Board.
...
https://olimex.wordpress.com/category/python/
one of several :
Sparkfun Esp8266 Thing Dev — Zerynth Docs documentation
Ok perhaps I should have been clearer. I can't install Python or Java on an ESP8266 just to download 32 byte of variables into each of the slave processors when I've got 50k of C++ application code running flat out doing the WiFi, webserver and system configuration and monitoring.
That said, it looks quite an impressive port. Surprised they got WiFi working as it's usually time critical so well done to the author.