Programming the USERROW without resetting the processor ?

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've completed my tests. My conclusions:

 

  1. It's not possible to use the NVM from the UPDI without a reset, even if you write the NVM activation key.
  2. The reset puts the CPU in some kind of suspended state where the NVM can be used.
  3. Outside of this special mode, any attempt to use the NVM from the UPDI results in an UPDI error.
  4. Therefore you can't write the user row without issuing a reset.
  5. 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.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes, the SRAM can be written while the CPU is running, and also the peripheral registers, except for the NVM.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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)

Last Edited: Wed. Jan 16, 2019 - 10:45 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

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 !

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

"Dare to be naïve." - Buckminster Fuller

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

 

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.