Emonpi auto reflash: Difference between revisions

From lechacal
Jump to navigation Jump to search
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 1: Line 1:


If you have installed the Emonpi image on your Raspberrypi and have connected the RPICT card on it then there are big chances the RPICT firmware has been wiped out.
If you have installed the Emonpi image on your Raspberrypi and have connected the RPICT card on it then there are big chances the RPICT firmware has been wiped out.
===Identifying the problem===


To confirm this is the case install the lcl-show-header.py utility with the commands below.
To confirm this is the case install the lcl-show-header.py utility with the commands below.
Line 12: Line 14:
  lcl-show-header.py
  lcl-show-header.py


If the RPICT firmware has been modified you will se the following message.
If the RPICT firmware has been modified the following message will be displayed.


[[File:Emonpi_header_01.png]]
[[File:Emonpi_header_01.png]]


===Reflash factory firmware===
To fix this you will have to restore the original firmware.


To fix this you will have to restore your original firmware. For this install avrdude as explained in the link below.
First thing is to stop the emonhub process.


[[Upload_Arduino_sketch_from_Raspberrypi_to_RPICT]]
sudo systemctl stop emonhub




Line 29: Line 34:
then upload it to the RPICT
then upload it to the RPICT


  lcl-upload-sketch.sh RPICT_MCP3208_v3.2.0.ino.hex
  avrdude -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:RPICT_MCP3208_v3.2.0.ino.hex
 
===Restore the configuration===


After that you should restore the factory configuration. You should have received a four letter code with the RPICT card. We will assume TKPJ in the example below. Replace TKPJ with appropriate.
Now the factory configuration must be restored. You should have received a four letter code with the RPICT card. We will assume TKPJ in the example below. Replace TKPJ with appropriate.


Get the configuration:
Get the configuration:
Line 40: Line 47:


  lcl-rpict-config.py -a -w TKPJ.conf
  lcl-rpict-config.py -a -w TKPJ.conf
At that point the RPICT card will be fully restored.
===If you intend to keep using the Emonpi image and prevent the reflash from happening.===
The right way to do this is still unknown to us. However we do have a solution that works for now. Let us know if you know a better solution.
Open the following file:
sudo nano /etc/rc.local
Then change line number 21 by adding a # in front to comment it like below.
#su pi -c '/opt/openenergymonitor/EmonScripts/update/firstbootupdate'

Latest revision as of 12:01, 5 May 2022

If you have installed the Emonpi image on your Raspberrypi and have connected the RPICT card on it then there are big chances the RPICT firmware has been wiped out.

Identifying the problem

To confirm this is the case install the lcl-show-header.py utility with the commands below.

wget lechacal.com/RPICT/tools/lcl-show-header.py.zip
unzip lcl-show-header.py.zip
sudo mv lcl-show-header.py /usr/local/bin/

Then run it with

lcl-show-header.py

If the RPICT firmware has been modified the following message will be displayed.

Reflash factory firmware

To fix this you will have to restore the original firmware.

First thing is to stop the emonhub process.

sudo systemctl stop emonhub


Then download the latest firmware

wget http://lechacal.com/RPICT/sketch/RPICT_MCP3208_v3.2.0.ino.hex


then upload it to the RPICT

avrdude -c arduino -p ATMEGA328P -P /dev/ttyAMA0 -b 115200 -U flash:w:RPICT_MCP3208_v3.2.0.ino.hex

Restore the configuration

Now the factory configuration must be restored. You should have received a four letter code with the RPICT card. We will assume TKPJ in the example below. Replace TKPJ with appropriate.

Get the configuration:

wget lechacal.com/hardware/c/TKPJ.conf

Write it

lcl-rpict-config.py -a -w TKPJ.conf

At that point the RPICT card will be fully restored.

If you intend to keep using the Emonpi image and prevent the reflash from happening.

The right way to do this is still unknown to us. However we do have a solution that works for now. Let us know if you know a better solution.

Open the following file:

sudo nano /etc/rc.local

Then change line number 21 by adding a # in front to comment it like below.

#su pi -c '/opt/openenergymonitor/EmonScripts/update/firstbootupdate'