Firmware update at Maxi Automation with SD Card

Post Reply
marcel00
Posts: 4
Joined: Tue Jul 02, 2019 5:03 pm

Firmware update at Maxi Automation with SD Card

Post by marcel00 » Tue Jul 02, 2019 5:31 pm

Hello

I want to use the Maxi Automation for an industrial application. It is mandatory to enable a firmware update by using a SD card module as network access is not allowed for security reasons. I already testet out a Arduino MEGA 2560 together with an Adafruit SD card module as shown at https://www.adafruit.com/product/254. The Module has got a level shifter and 3.3 V regulator on board. I have succeeded in firmware updating as it is described at https://github.com/FleetProbe/MicroBrid ... ATMega2560 if the Arduino Mega 2560 is used with the card module. If I repeat the procedure by using the appropriate pins at the Maxi Automation and try to initiate the flash pressing a momentary switch I can shortly see a yellow LED inside the Maxi. I can also see that the reset routine is entered correctly by printing "Flash" on the serial monitor. But furthermore nothing happens. Initially the modified bootloader was successfully uploaded with a Diamex AVR ISP programmer and a 26 to 6 pin ISP adapter board.
I posted this issue at hardware. I am not sure if it is true or if it is a software problem.

Best regards

Marcel Rouenhoff

User avatar
Lukas
Posts: 34
Joined: Tue Dec 18, 2018 3:44 pm

Re: Firmware update at Maxi Automation with SD Card

Post by Lukas » Wed Jul 03, 2019 2:07 pm

Hello,

please, check our FAQ No.7 at GitHub.

This may be the source of your troubles - you should handle the chip select signals for the Ethernet and RTC in the modified bootloader also.

Best regards,
Lukas

marcel00
Posts: 4
Joined: Tue Jul 02, 2019 5:03 pm

Re: Firmware update at Maxi Automation with SD Card

Post by marcel00 » Thu Jul 04, 2019 9:13 am

Hello Lukas,

flashing works now. But only if I open the serial monitor in the Arduino IDE. I use a control LED on pin 43. If I press a momentary switch on pin 42 this LED is turned off and EEPROM flash address 1FF is set to F00. Now I turn of the MCU and after switching on Arduino MEGA 2560 immediately starts to flash from SD card but the MAXI Automation does not. It only starts to flash if I start the Arduino IDE and open the Serial monitor. Than it starts to flash and after finishing LED on pin 42 starts to light up again. It would be nice if this is not needed and the LED would blink while flashing instead of the one connected to PB7 at the Arduino MEGA2560. PB7 is the AO1 at the Maxi automation so you will not see it if it is not connected to a lamp.
So how can I emulate a sort of reset as it is done if the Serial monitor is opened and how can I compile the SD dual bootloader after PB7 has been changed to PL7 (pin 42)?

Best regards,

Marcel

marcel00
Posts: 4
Joined: Tue Jul 02, 2019 5:03 pm

Re: Firmware update at Maxi Automation with SD Card

Post by marcel00 » Thu Jul 04, 2019 11:28 am

Hello Lukas,

I used the following code to reset:

Code: Select all

void softwareReset( uint8_t prescaller) {
  wdt_disable();
  // start watchdog with the provided prescaller
  wdt_enable( prescaller);
  // wait for the prescaller time to expire
  // without sending the reset signal by using
  // the wdt_reset() method
  while (1) {}
}
This works and flashing starts. The only remaining question is: How can I compile the SD dual bootloader after changing Flashing LED port from PB7 to PL7?

User avatar
Lukas
Posts: 34
Joined: Tue Dec 18, 2018 3:44 pm

Re: Firmware update at Maxi Automation with SD Card

Post by Lukas » Thu Jul 04, 2019 11:52 am

Hello Marcel,

you can find the information here

c:\Program Files (x86)\Arduino\hardware\arduino\avr\bootloaders\optiboot\README.TXT

The procedure should be the same for the stk500v2 bootloader (or its clones).

Good luck!
Lukas

Post Reply