GEM firmware upgrade seems to have failed, what now?

Ask questions about the GEM here.
ben
Site Admin
Posts: 4265
Joined: Fri Jun 04, 2010 9:39 am

Re: GEM firmware upgrade seems to have failed, what now?

Post by ben » Mon Dec 26, 2022 1:48 pm

vilord wrote:
Mon Dec 26, 2022 1:40 pm
The usb-rs232 cable i was using is an old counterfeit prolific cable, yes.

I found an old dell d630 in the garage (nearly 16 years old!) found a power cord that will fit it. Powered it up and it has an on-chipset intel RS232 port. Hooked up some wires from pins 2, 3, and 5 to rx, tx, and GND respectively.
Powered up the GEM with the button pressed, let go, sys led turns red, comm led is still green as before. kicked off the firmware flash... error 222 / timeout
Tried swapping the RX/TX... same error.
This is all I've gotten from the prolific cable today as well.
The wiring souinds right:

Pin 2 to RX
Pin 3 to TX
Pin 5 to GND

Make sure you're connected to COM1 on the GEM at 115200 baud. You may have to throw it into Recovery Mode for each try as a byte could mess up the process.
Ben
Brultech Research Inc.
E: ben(at)brultech.com
vilord
Posts: 32
Joined: Fri Aug 23, 2019 10:54 am

Re: GEM firmware upgrade seems to have failed, what now?

Post by vilord » Mon Dec 26, 2022 2:38 pm

Ding ding ding! We have a winner folks!
The combination of using the right RS232 interface, at the right speed, with the right wiring.

Here are the instructions I could have used to save myself from a headache and getting snippy on the internet ;) :D

When performing a firmware update "over the air" using either the Java Firmware Upgrader or the GEM Network Utility connecting to port 8000, you *must* first go to setup and change the baud rate of the gem down to 19200. Whatever device is connecting to that port (dashbox, xbee, network interface, etc) may also need to be reconfigured to that speed.

However, when performing a recovery of the firmware using a direct RS232 connection, you must connect at 115200... not 19200 as used for OTA / standard firmware updates. The board won't respond at 19200.
Also, USB-TTL adapters will *not* work, and will likely blow out your TTL adapter's chip as it is expecting 0-3.3v or 0-5v and RS232 can range from 0 to negative 12 or 15 volts

Steps to make it go (some settings may be superfluous and may get overridden by the network utility in any case):
You need to use a windows laptop, as the GEM Network Utility is the only current tool capable of sending a recovery firmware, and it is windows-only.
Windows in a VM on top of linux or mac *might* work if you have a really good usb to rs232 interface and the VM is configured to have raw access to that USB port, but this is not recommended.
Best case: RS232 port from a real (old) laptop motherboard, set to 115,200 / 8 data bits, 1 stop bits, no parity, no flow control, FIFO buffers enabled and set to "high"

RS232 pin 2 (RX) to GEM COM1 (TX)
RS232 pin 3 (TX) to GEM COM1 (RX)
RS232 pin 5 (GND) to GEM RS232 GND

In the GEM Network Utility, choose serial mode, hit Find Serial Ports, select the correct laptop port (com1 because it has just 1). Serial Port Baud 115200
Make sure connection status is "closed" and the background is red

In the COM firmware section, Select Firmware File and choose the C firmware, then enable the recovery mode checkbox

With the GEM powered off, unplug any network cables, dash box/add-on serial interfaces, etc.
Remove the CR2032 battery (a pair of needle-nose pliers or a sharp edged flat blade screwdriver may help here to get it out. Careful not to damage the board!)

Next, with the battery removed and the RS232-com connection in place, power up the GEM with the bottom "PB Switch" button held down. Look for green LED on COMM LED. Release the button, the SYS LED will go from off to solid red.

Hit start in the Network Utility to deploy the firmware. The progress bar should nearly immediately begin to move. You will know the GEM is receiving data because the SYS LED's green LED will flicker while the red LED stays on. Network utility should say completed successfully, and the GEM's SYS LED will start a blink sequence instead of being solid red. Mine went green-red, red, red, red and repeated.
At this point the Get GEM info button should be working.

If the progress bar doesn't move, the laptop is not getting a correct signal from the GEM. Double check the pins, wires, and port settings.
If the progress bar moves, but the green SYS LED does not flicker during the transfer, the GEM isn't actually receiving any data. Again, check the pins, wires, and port settings.

If the memory may have been corrupt due to a bad power supply or power brownouts/blackouts/etc (did you notice any strange characters in any of the settings screens before you started?) it will be best to reset factory defaults. If you can't connect because of an incorrect password, check the Debug tab of network utility, there is a password reset option.
ben
Site Admin
Posts: 4265
Joined: Fri Jun 04, 2010 9:39 am

Re: GEM firmware upgrade seems to have failed, what now?

Post by ben » Mon Dec 26, 2022 2:55 pm

Glad to hear you got it. I'll speak with Paul tomorrow, we should just have a 1-pager like you've typed out.

Check to make sure Flow Control is off on COM1/2 now that you're back in action. That can cause random lockups due to the RTS/CTS pins floating like you were experiencing.
Ben
Brultech Research Inc.
E: ben(at)brultech.com
vilord
Posts: 32
Joined: Fri Aug 23, 2019 10:54 am

Re: GEM firmware upgrade seems to have failed, what now?

Post by vilord » Mon Dec 26, 2022 6:19 pm

Well, I thought I was good... It flashed successfully and I was able to get into and set all the settings on my desk.
Even hooked up the dashbox there to make sure communication worked through it, all was well.

Then I brought it downstairs and hooked up all of the CT wires and powered it up and it had a new flash error code and was not reporting to the dashbox.
I figured maybe the ram was corrupt again, so I took out the battery and reset it... same flash sequence.
then i was like, well, maybe that flash wasn't as clean as i thought it was, so i brought my whole flash laptop and cables and so on to the laundry room and now i'm standing over the washer and dryer with another solid red light.

Should I try loading an older firmware on it (if i can even get it flashing again? It's now sticking at 0.0% again)... I'm going to unhook all 28 CT's again now... this is just so much fun...
vilord
Posts: 32
Joined: Fri Aug 23, 2019 10:54 am

Re: GEM firmware upgrade seems to have failed, what now?

Post by vilord » Mon Dec 26, 2022 6:36 pm

Okay, and apparently now it only will take a flash at 19200, and changing the baud rate to 115200 changes it in the settings but it still refuses to respond to anything faster than 192... And then another attempt at changing to 1152, followed by another comm processor reset button (in the network utility) and everything is back to how it was 3 hours ago....

I'm hopeful.
But not confident.
ben
Site Admin
Posts: 4265
Joined: Fri Jun 04, 2010 9:39 am

Re: GEM firmware upgrade seems to have failed, what now?

Post by ben » Tue Dec 27, 2022 10:46 am

vilord wrote:
Mon Dec 26, 2022 6:19 pm
Well, I thought I was good... It flashed successfully and I was able to get into and set all the settings on my desk.
Even hooked up the dashbox there to make sure communication worked through it, all was well.

Then I brought it downstairs and hooked up all of the CT wires and powered it up and it had a new flash error code and was not reporting to the dashbox.
I figured maybe the ram was corrupt again, so I took out the battery and reset it... same flash sequence.
then i was like, well, maybe that flash wasn't as clean as i thought it was, so i brought my whole flash laptop and cables and so on to the laundry room and now i'm standing over the washer and dryer with another solid red light.

Should I try loading an older firmware on it (if i can even get it flashing again? It's now sticking at 0.0% again)... I'm going to unhook all 28 CT's again now... this is just so much fun...
What was the flash error code?
vilord wrote:
Mon Dec 26, 2022 6:36 pm
Okay, and apparently now it only will take a flash at 19200, and changing the baud rate to 115200 changes it in the settings but it still refuses to respond to anything faster than 192... And then another attempt at changing to 1152, followed by another comm processor reset button (in the network utility) and everything is back to how it was 3 hours ago....

I'm hopeful.
But not confident.
Are you back to a solid red LED? Try removing the battery, unplug, wait 5 seconds, plug back in. If it has a solid Green SYS LED that flashes red once in awhile you're still operational and likely just have a baud rate mismatch.

Once plugged into the DashBox, try accessing the GEM Setup Webpage/pulling settings via Ports 8001 (RS232 #1) or 8002 (RS232 #2). If that doesn't work, check Settings->System->Change Baudrates on the DashBox. If it says "Unknown Device" you likely have a baud rate mismatch.

COM1 defaults to 115200, COM2 defaults to 19200. When you loaded the F/W and cycled power it's likely those got set back to the defaults.

You should do all F/W programming thru COM1 on the GEM as it's the main COM port.
Ben
Brultech Research Inc.
E: ben(at)brultech.com
vilord
Posts: 32
Joined: Fri Aug 23, 2019 10:54 am

Re: GEM firmware upgrade seems to have failed, what now?

Post by vilord » Tue Dec 27, 2022 12:42 pm

The error code when I tried to reflash it was 222 / timeout. The sys LED has a sequence at the moment of Green, red-green, red, off (where red-green is a very quick succession of red then green).

The weird thing was that it was working fine upstairs on COM1 at 115200 baud, but by the time i had everything plugged back in in the laundry room it had switched itself to 19200 (again, on COM1), so the dashbox couldn't see it (either in the dashbox interface or through port 8001), the laptop couldn't talk to it (at 115200), and flashing failed (at 115200). Restarting in firmware recovery mode it still couldn't flash until i switched the laptop to 19200, so when i was upstairs it would only flash recovery at 115200, and downstairs it would only flash recovery at 19200. Baffling.

Right now it is sending data to the dashbox just fine at 115200, and I'm able to reach the configuration pages through dashbox and through port 8001. I've configured the unused dashbox port 2 at 19200 in case this weirdness happens again i can try switching between dashbox ports.

I hadn't touched COM2 at all from a programming perspective since I got the initial flash to work with your help yesterday while it was on my desk, as I'm planning to send data to something in the xbee slot as mentioned on the github thread. I set COM2 to ASCII post mode... I noticed I was only getting data from the first 7 channels, so i figured maybe that only works for an ECM1240, then I switched it to one of the HTTP POST modes (COM2 is limited in what modes it will support, http get is not one of them), but only got data from the first 4 channels, so for now i switched it back to BIN48-NET-TIME to match COM1.
I don't imagine that changing the COM2 post data mode would have any effect on the baud rate, but setting it to ascii was the last thing I did before unplugging it at my desk.

When I get some more time after NYE I will look at setting up the ESPs to post data from the emporias to dashbox so i can get the good dashbox dashboarding for the whole house, and also gem -> mqtt/home assistant directly, so I don't need to rely on the dashbox to retransmit it, and getting the dashbox out of the laundry room would be nice, so using the ESP to post via HTTP GET to dashbox instead of relying on the rs232 cable would be a nice bonus.

And just to clarify because I said a lot ^ there, GEM is working well at the moment posting to Dashbox. Dashbox dashboards are working for what the GEM sees (the house 30/40 panel and laundry room subpanel). Dashbox is posting MQTT to home assistant. Home assistant energy dashboard includes information from the GEM and both emporias (garage 30/40 and basement subpanel, solar tie-in, 400a grid connection).
ben
Site Admin
Posts: 4265
Joined: Fri Jun 04, 2010 9:39 am

Re: GEM firmware upgrade seems to have failed, what now?

Post by ben » Tue Dec 27, 2022 12:59 pm

vilord wrote:
Tue Dec 27, 2022 12:42 pm
The error code when I tried to reflash it was 222 / timeout. The sys LED has a sequence at the moment of Green, red-green, red, off (where red-green is a very quick succession of red then green).

The weird thing was that it was working fine upstairs on COM1 at 115200 baud, but by the time i had everything plugged back in in the laundry room it had switched itself to 19200 (again, on COM1), so the dashbox couldn't see it (either in the dashbox interface or through port 8001), the laptop couldn't talk to it (at 115200), and flashing failed (at 115200). Restarting in firmware recovery mode it still couldn't flash until i switched the laptop to 19200, so when i was upstairs it would only flash recovery at 115200, and downstairs it would only flash recovery at 19200. Baffling.

Right now it is sending data to the dashbox just fine at 115200, and I'm able to reach the configuration pages through dashbox and through port 8001. I've configured the unused dashbox port 2 at 19200 in case this weirdness happens again i can try switching between dashbox ports.

I hadn't touched COM2 at all from a programming perspective since I got the initial flash to work with your help yesterday while it was on my desk, as I'm planning to send data to something in the xbee slot as mentioned on the github thread. I set COM2 to ASCII post mode... I noticed I was only getting data from the first 7 channels, so i figured maybe that only works for an ECM1240, then I switched it to one of the HTTP POST modes (COM2 is limited in what modes it will support, http get is not one of them), but only got data from the first 4 channels, so for now i switched it back to BIN48-NET-TIME to match COM1.
I don't imagine that changing the COM2 post data mode would have any effect on the baud rate, but setting it to ascii was the last thing I did before unplugging it at my desk.

When I get some more time after NYE I will look at setting up the ESPs to post data from the emporias to dashbox so i can get the good dashbox dashboarding for the whole house, and also gem -> mqtt/home assistant directly, so I don't need to rely on the dashbox to retransmit it, and getting the dashbox out of the laundry room would be nice, so using the ESP to post via HTTP GET to dashbox instead of relying on the rs232 cable would be a nice bonus.

And just to clarify because I said a lot ^ there, GEM is working well at the moment posting to Dashbox. Dashbox dashboards are working for what the GEM sees (the house 30/40 panel and laundry room subpanel). Dashbox is posting MQTT to home assistant. Home assistant energy dashboard includes information from the GEM and both emporias (garage 30/40 and basement subpanel, solar tie-in, 400a grid connection).
Can you send over/check the Status page from the GEM Setup Webpage? It sounds like you may have a communication H/W option enabled given that LED sequence/baud drop.

You can send a ^^^SYSHDW00 command to disable both HW options (more info on that command here: https://www.brultech.com/software/files ... _11.0_.pdf)
Ben
Brultech Research Inc.
E: ben(at)brultech.com
vilord
Posts: 32
Joined: Fri Aug 23, 2019 10:54 am

Re: GEM firmware upgrade seems to have failed, what now?

Post by vilord » Tue Dec 27, 2022 1:06 pm

Ah, yes it looks like you're right, see attachments. Status tab thinks it has a network card, though the network tab does not agree.

I did (more than once) use the network utility to tell it that it had no modules on the firmware tab.
Attachments
gem_status_2.jpg
gem_status_2.jpg (63.41 KiB) Viewed 16608 times
gem_status_1.jpg
gem_status_1.jpg (307.16 KiB) Viewed 16608 times
vilord
Posts: 32
Joined: Fri Aug 23, 2019 10:54 am

Re: GEM firmware upgrade seems to have failed, what now?

Post by vilord » Tue Dec 27, 2022 1:09 pm

ben wrote:
Tue Dec 27, 2022 12:59 pm
You can send a ^^^SYSHDW00 command to disable both HW options
Is this something I can do through dashbox, or do i need to hook back up the programming laptop?
Post Reply