tagyoureit / nodejs-poolController

An application to control pool equipment from various manufacturers.
GNU Affero General Public License v3.0
315 stars 94 forks source link

Documenting Pentair Intellivalve communications #363

Open jeffegg opened 2 years ago

jeffegg commented 2 years ago

Describe the bug Not really a bug, more of a feature enhancement. And maybe this isn't the correct place for this, maybe the wiki would be better. Let me know Currently (as I understand) the intellivalve is minimally supported in nodejs-PoolController. In my copious extra time, between family and work, I decided to see what I can do to help improve support. So I ordered an extra intellivalve when adding some to my pool in hopes that I can help this out. Seems I am able, looking at the hardware, there is a PIC16F1718 inside (Yay), as well as a ICSP port, so using MPLABX and an ICD4, I dumped the FW. I'm currently in the process of dissembling the FW from using MPLAB, and Ghidra (thanks NSA :)) I don't know what will be supported, but since I actually made the valve do something from message Center based on the FW (reset) maybe I can figure out something useful, like setting new endstops, etc. Else, I've reverse engineered a partial schematic for the valve and I'll write my own FW. Both efforts will probably take a few weeks, depending on work schedule. FYI I use Pool controller in Nixie single body mode, and I don't have a Pentair panel to reverse engineer communications (assuming the panels have some interesting support.) This would be easier to capture packets and reverse engineer, but I'm not interested in the panel, so don't want to spend the money on it.

Commands I know (as of 10/31/21)

SW reset of valve: Action: 0xF7 (247)

Sent Packet: FF00FF A5 3F 0C 10 F7 04 01 01 F9

 Dissasmbled FW:           
          if (((RX_BUFF_OTHER?[7] == 0xf7) && (RX_BUFF_OTHER?[5] == DAT_DATA_006b)) && (RX_BUFF_OTHER?[9] == 1)) {
                      FUN_CODE_32aa(1); // Not sure what this does yet
                      reset();
_DAT_DATA_006b // Looks to be the valve address, I'm guessing with multiple valves we probably can address, mine is set to 0xC(12) by default._ 

Response Packet: Source: 12 (Valve); Dest: 16(OCP), Action: 1, Data Length 1: 247, Header [165,1,16,12,1,1] Term: [0,167]

jeffegg commented 12 months ago

Yeah the blinky mode is short, I guess 10 seconds is correct. You should be able to flash from any mode, but glad to hear it started to work. Moving forward I can force the valve to start in blue blinky mode longer I think. I'll investigate tonight

bluemantwo commented 12 months ago

Got it flashed and it is working!!!! Still playing around with it, but it is doing everything I tell it to do! I am kind of crazy this week and next with some projects, but will do more detailed testing after that. For now, this is just AMAZING!!! Thanks!

Capture

bluemantwo commented 12 months ago

One small item: current valve position is showing correctly in log, but not in display. For example, if I set valve to 24 (90 degrees) and press save, it moves, but the value on the display stays at the prior location. If I hit save again, it will then update. Minor.

EDIT: I guess it is just a page refresh issue. If I refresh the page and go back to it, all values are updated. So more just an issue of my not being familiar with njsPoolController.

I have been successful at setting custom end points for 0 and 24, and using red/white wires to select active end point. Everything that I want it to do is working great!

rstrouse commented 12 months ago

@jeffegg when are you ready to integrate the njsPC and dashPanel changes into the core repos? It looks like I need to dust off some of the previously dead valves and give this a shot.

jeffegg commented 12 months ago

@bluemantwo, I filed an issue over in the FW repo. I'd say any issues with either FW or SW should be posted as an issue in that repo. If you have questions feel free to update there as well. I'll try to push issues over there if I see them here.

jeffegg commented 12 months ago

Also, I like the ability you added to press RED + YELLOW to reverse the valve (simulate swapping red/white wires). Very cool! Can this also be added programmatically to simulate swapping red/white wires aka swap selected endstops?

This is actually a pentair feature I find super helpful, when I'm at the pad and don't have some connection to REM. I can definitely add it programmatically as well. And thinking about this I should. We should also do feature request over on my repo as well. I think there will be a few. I need to do a FW diet, shortly I'm using about 88% of the code: I have some major overlaps and can probably head towards <70%. So we have some room to expand

bluemantwo commented 11 months ago

@jeffegg , I see new version up today. I will give it a try. I will be out of town for a week starting Monday, but will provide whatever feedback I can.

Do I just need to re-flash the firmware? Or do I also need to re-download the njspc modules as well?

Cheers!

jeffegg commented 11 months ago

@bluemantwo the version released was a test version I wouldn't use. I plan to get a new version out this evening that has a new FW update feature as well as some other fixes. Looks like it will miss the timeline before your vacation. This release I think will just be FW, next week will be a full stack update. Have a good vacation.

bluemantwo commented 11 months ago

@jeffegg , just got back from being out of town for past week. I plan to load new software and test this week sometime. Thanks for the continued development.

bluemantwo commented 11 months ago

`>>> fwu.fw_updater() Index Device Product Serial # HW ID


  1  /dev/ttyUSB0  USB2.0-Serial              USB VID:PID=1A86:7523 LOCATION=1-1.2
  2  /dev/ttyAMA0                             3f201000.serial

Default RS485 device is (hit enter to select): /dev/ttyUSB1 Please select the index of your RS485 device: 1 Device /dev/ttyUSB1 was selected. Opening serial port: /dev/ttyUSB0 Forcing all address reset on all Pentair FW Valves Waiting 5 seconds for message to send and valves to quiet a bit Sending ID valves packet to Valves with Eggy's Intellivalve Firmware Waiting 5 seconds for message to send and valves to quiet a bit Listening to /dev/ttyUSB0 for 30 seconds. Traceback (most recent call last): File "", line 1, in File "/home/pi/fwupdate/main.py", line 265, in fw_updater device_list = self.find_all_valves(enumerate_timeout=enumerate_timeout) File "/home/pi/fwupdate/main.py", line 656, in find_all_valves valve: bytearray = ser.read(size=10000) File "/usr/lib/python3/dist-packages/serial/serialposix.py", line 577, in read raise SerialException( serial.serialutil.SerialException: device reports readiness to read but returned no data (device disconnected or multiple access on port?)

`

Any ideas? I have existing valve with 0.2.1 firmware and a new valve with factory firmware connected.

jeffegg commented 11 months ago

@bluemantwo is njsPC running? That would be my first suspect. Right now we need exclusive access to the RS485 controller to update the FW. Please note the 0.2.1 FW will not properly update with the updaters, you will need to power cycle the valve to get it to be recognized, new versions don't have this restriction. I can type up instructions if need be for you

bluemantwo commented 11 months ago

Doh! njspc still running. Stopped it. Got further, but another issue. Existing 0.2.1 firmware valve is not recognized. Did a power cycle but no joy.

Index Address UUID Git Hash Git Date Branch Tag DID RID


  1             Valve Not found  N/A

Please select the index of the Valve for FW update:

bluemantwo commented 11 months ago

Tried attached 2nd valve with factory firmware. Finds that one, but failed trying to flash it. See below

fwu.fw_updater() Index Device Product Serial # HW ID


1 /dev/ttyUSB0 USB2.0-Serial USB VID:PID=1A86:7523 LOCATION=1-1.2 2 /dev/ttyAMA0 3f201000.serial Default RS485 device is (hit enter to select): /dev/ttyUSB1 Please select the index of your RS485 device: 1 Device /dev/ttyUSB1 was selected. Opening serial port: /dev/ttyUSB0 Forcing all address reset on all Pentair FW Valves Waiting 5 seconds for message to send and valves to quiet a bit Sending ID valves packet to Valves with Eggy's Intellivalve Firmware Waiting 5 seconds for message to send and valves to quiet a bit Listening to /dev/ttyUSB0 for 30 seconds. Closing Serial Port: /dev/ttyUSB0 Type Address UUID


Pentairs's FW 0xc 04-91-62-d6-48-dd Index ID Tag Name Prerelease Publish Date Has FW release


1 0x6e143a2 v0.3.0 Version 0.3.0 - alpha release False 2023-08-07T08:35:13Z True 2 0x6e061ac v0.2.5 Version 0.2.5 - alpha release False 2023-08-06T08:52:58Z True 3 0x6d4d280 v0.2.4 Version 0.2.4 - alpha release False 2023-08-01T08:05:07Z True 4 0x6d24623 v0.2.3 Version 0.2.3 - alpha release False 2023-07-31T07:37:27Z True 5 0x6d17d0f v0.2.2 Version 0.2.2 - alpha release - test only True 2023-07-30T08:29:35Z True 6 0x6bf8208 v0.2.1 Version 0.2.1 - alpha release False 2023-07-23T07:46:43Z True 7 0x6bf0a14 v0.2.0 Version 0.2.0 - alpha release True 2023-07-22T08:25:46Z True 8 0x6a53e25 v0.1.1 Version 0.1.1 - Pre-Alpha Release True 2023-07-08T09:17:30Z True 9 0x6a5364e v0.1.0 Version 0.1.0 - Pre-Alpha Release True 2023-07-08T07:48:16Z True 10 0x68b86f1 v0.0.1 DirtyUnsupportedFW True 2023-06-25T09:15:16Z False 11 0x5966af9 v0.0.0 True 2023-02-27T06:05:59Z False Please select the fw release: 1 Index Address UUID Git Hash Git Date Branch Tag DID RID


1 0xc 04-91-62-d6-48-dd N/A 2 Valve Not found N/A Please select the index of the Valve for FW update: 1 Valve 04-91-62-d6-48-dd was selected. Reallocated Valve Address if needed Type Address UUID


Pentairs's FW 0xa0 04-91-62-d6-48-dd Forcing valve address: 0xc uuid: 04-91-62-d6-48-dd to reset Setting valve 04-91-62-d6-48-dd to 0xc Setting valve 04-91-62-d6-48-dd to 0xc Opening serial port: /dev/ttyUSB0 programming 0x0F80 Unexpected packet read: vs ff-00-ff-a5-01-10-0c-01-01-f5 on line {'byte_count': 64, 'address': '0F80', 'data': '8731CB2FFF34FF347E148731A0310D2087317E10090020000308A0008F317B2F2200B9002200BA01F62F22003A082200B700B801370822003407860022003808', 'checksum': None} retry 0 of 10 and retry of retry 0 Setting valve 04-91-62-d6-48-dd to 0xc Setting valve 04-91-62-d6-48-dd to 0xc programming 0x0F80 retry 1 of 10 and retry of retry 1 Setting valve 04-91-62-d6-48-dd to 0xc Setting valve 04-91-62-d6-48-dd to 0xc programming 0x0F80 retry 2 of 10 and retry of retry 2 Setting valve 04-91-62-d6-48-dd to 0xc Setting valve 04-91-62-d6-48-dd to 0xc programming 0x0F80 retry 3 of 10 and retry of retry 3 Setting valve 04-91-62-d6-48-dd to 0xc Setting valve 04-91-62-d6-48-dd to 0xc programming 0x0F80 retry 4 of 10 and retry of retry 4 Setting valve 04-91-62-d6-48-dd to 0xc Setting valve 04-91-62-d6-48-dd to 0xc programming 0x0F80 retry 5 of 10 and retry of retry 5 Setting valve 04-91-62-d6-48-dd to 0xc Setting valve 04-91-62-d6-48-dd to 0xc programming 0x0F80 retry 6 of 10 and retry of retry 6 Setting valve 04-91-62-d6-48-dd to 0xc Setting valve 04-91-62-d6-48-dd to 0xc programming 0x0F80 retry 7 of 10 and retry of retry 7 Setting valve 04-91-62-d6-48-dd to 0xc Setting valve 04-91-62-d6-48-dd to 0xc programming 0x0F80 retry 8 of 10 and retry of retry 8 Setting valve 04-91-62-d6-48-dd to 0xc Setting valve 04-91-62-d6-48-dd to 0xc programming 0x0F80 retry 9 of 10 and retry of retry 9 Setting valve 04-91-62-d6-48-dd to 0xc Setting valve 04-91-62-d6-48-dd to 0xc programming 0x0F80 Packet never sent after 10 retries exiting. Valve will be in a bad state.Please try to quiet RS485 and/or increase retries Trying to force exit FW mode, sleeping for 20 seconds Sleeping another 5 seconds

jeffegg commented 11 months ago

Sometimes the reset doesn't go through it seems. Thought I got that fixed, but after seeing retry 0 of 10 and retry of retry 0 Setting valve 04-91-62-d6-48-dd, you can power cycle the valve, and it should start programming

bluemantwo commented 11 months ago

Tried power cycling while it was doing the retries, but no joy. Failed 10/10.

Oh, what mode should it be in? Service?

jeffegg commented 11 months ago

Just an FYI that blue led at first power is a small bootloader that times out without proper commands. I wonder if we are timing out before we send the commands

jeffegg commented 11 months ago

Not in service mode, needs to be in Auto. The old FW uploader should still work to flash the stock valves, just need to point to the correct FW. If nothing is working I can add more debug messages. I did use the new FW updater on 2 brand new valves and it seemed to work Ok. But it's possible I changed something after the fact.

bluemantwo commented 11 months ago

OK, I was able to flash the old 0.2.1 firmware I think. I had 2 valves connected via RS485. One on 0.2.1 firmware, and other on factory firmware. I told the program to flash the one with Factory firmware, but it started doing the retries, so I power cycled both (one transformer), and oddly the 0.2.1 valve was apparently flashed. Lots of errors along the way, but it did finish. I will do some more playing. Attached is the output from python.
log.txt

jeffegg commented 11 months ago

Yes the stock FW spews out the hail packet periodically and will corrupt anything in flight. I dont understand how you got the FW to flash on the 0.2.1 valve without having the correct UUID sent, the bootloader does check this. I think think I know the issue: there was a bug in 0.2.1 FW where you could overflow the buffer internally and cause a reset. When in the bootloader all Valve's look like the Pentair FW... I suspect the buffer overflow rebooted the 0.2.1 FW while it was pooling for responses. If you get a chance can you run the FWupdater again to see if it recognizes the 0.3.0 FW and send the output, I'm curious on the UUIDs. You don't need to flash, when selecting the valve to update if you type a # that is not on the screen like 99, it will exit. Or CTRL-C works as well. I want to see if the UUID flashed was really the new valve.

jeffegg commented 11 months ago

Also let me know if you need the original Pentair FW to move back to stock.

bluemantwo commented 11 months ago

I decided it was a bit confusing to have both valves attached, so I connected one at a time. But for some reason now both of them refuse to show what firmware they are on and just say " Valve Not found" with no UUID listed. So I cannot confirm right now if either or both are on old firmware or new firmware.

But at one point, one of the valves did show 0.3.0 firmware was on it. Not sure why now neither of them show which firmware is on it. Let me play around some more.

bluemantwo commented 11 months ago

I think I will try to attack this in the morning. Have to get up for early call tomorrow. But it appears the factory firmware valve is still on factory firmware (control buttons are working to rotate the valve in service mode) but firmware updater software shows "Valve not found". Other valve that was on 0.2.1 firmware I think is on 0.3.0 firmware, but now also shows "Valve not found" in the firmware updater. I tried talking to each valve by itself (just one valve at a time) and still no joy. Will let you know what I find tomorrow. Thanks again for all the work!!!!

jeffegg commented 11 months ago

I actually added support for moving valve with buttons in Service mode in release 0.3.0 (actually a bit earlier) I just didn't test it out till you mentioned it was working (it seems to work). So it's possible all valves have the correct FW for you. One way to force Valve ID is to hit the RED button + Save button (like you did before to get the valve in njsPC); hit it a few times when you see Listening to /dev/ttyUSB0 for 30 second in the valve updater. Or you can get the valves running in njsPC to verify FW versions. I do see something similar now that I played around. I have 4 valves in my setup, I reflashed them all to latest FW. There are 2 really happy valves that always ID correctly when asked, there is another that 1 seems to correctly work every when I power cycle just it by itself, and my 4th valve (setup with a debugger) that works in debug mode all the time, but has the same needs to be power cycled by itself. I think they way I was working I just got lucky and all valves were in "good" state. I suspect there is some uninitialized variable around the remote Valve ID feature or in one of the timers; I'm able to see things work that don't rely on the timers just fine. So you could try playing around with power cycling them...

jeffegg commented 11 months ago

Ok that was a fun bug, the bootloader can leave the RS485 (UART) transmitter in a bad state where packets cannot be received till the error is cleared. Fixed this now and see much better results in FW 0.3.1 I just released

bluemantwo commented 11 months ago

I will give it a try today! This is the part of early testing that I love. Finding corner cases and breaking things. Or doing things in a way no one intended. I am good at that. ;)

bluemantwo commented 11 months ago

EDIT: ignore comment I just made on 0.3.1 still not working. I realized I was still using old version. I will test again in a bit.

jeffegg commented 11 months ago

Did you get the new FW installed on the valves? That will be the only fix. Best bet if the valves are not coming up to flash the FW is to push the red + save button when trying to I'd the valve. Then you will probably need to power cycle the valve during programming.

bluemantwo commented 11 months ago

I think I must be doing something more fundamentally wrong. I cannot get either valve to show up. Do I need to update my version of REM? I have stopped njsPC but still have REM running.

I will try running njsPC in command line and see if I can see what communications are going on with the valves.

jeffegg commented 11 months ago

REM doesn't matter here. Do you see the valves show up when you press the red + save button (try hitting a few times when in auto mode green light on)? You want to do this during Listening to /dev/ttyUSB0 for 30 seconds. If not try power cycling during this time.

jeffegg commented 11 months ago

And I do recommend updating the versions of dash panel and njsPC to the latest version from my GitHub. And make sure to run npm I on both and use Ctrl F5 to make sure chrome updates.

bluemantwo commented 11 months ago

I am able to attach a new Valve with factory firmware to the system, and it finds it. But neither of the other 2 valve which I had tried to flash will show up. Tried lots of different configs, but the always show "Valve not found". I am going to start from scratch with fresh downloads and make sure something else is not going on.

jeffegg commented 11 months ago

Ok I can generate a new FW uploader tonight that dumps more info. Did hitting the buttons help? Did you try njsPC? The fw uploader is very basic and doesn't have many features.

bluemantwo commented 11 months ago

Hitting the buttons on the existing 2 valves that I tried to flash does not generate any activity on the bus. It does on the 3rd valve that was not flashed yet. But rather than jump to conclusions, I need to slow down and take a more methodical approach to this. I might have done something else wrong. Would not be the first time!

bluemantwo commented 11 months ago

Well, I was finally able to get the valve that originally was on 0.2.1 to 0.3.1. It now shows up reliably in the updater tool and shows it is on the new firmware.

The other valve that I had tried to flash with 0.3.0 is in a state where the Red/Blue/Yellow lights are all flashing on and off repeatedly. Not sure if bricked or just in an odd mode. No communications over the bus, even when save/red buttons pressed. Appears inert.

3rd factory valve also shows up reliably, but is still on factory firmware.

jeffegg commented 11 months ago

We should be able to recover any valve. The bootloader is pretty protected from damage. It sounds like that valve didn't get a full FW download or maybe the EEPROM is corrupted. You can try updating the FW by power cycling it. I can update the fw uploader to better walk through the process. But good to see at least 1 is working

bluemantwo commented 11 months ago

@jeffegg , I am not too worried about the valve that is locked up. But if there is an easy way to reload a new firmware, let me know. But low priority to me. I am going to update a few more to 3.1 just to see how things go.

MaxVonEvil commented 11 months ago

I've been following this thread with interest. That said I do not have any itellivalves, instead I have some, ahem.. ratherStupidValves ;) i.e. regular Jandy-valves with standard dual-position 24VAC valve actuators. Just wanted to chip in how I made those variable. It's rather simple and rather low-tech, compared to the Intellivalve hacking.

Full disclosure, I currently only use NJSPC for my pump, as all the rest including the house was already run by Homeassistant/NodeRed, with an ESP32 running Tasmota at the poolgear. I've adjusted the camber wheels inside my valve actuators so they can travel the range I need.

I'm using two relays per valve; one for direction, another to cut actuator power after x seconds of travel. Initially measured by stopwatch, I know it takes about 36 seconds for my actuators to turn a valve 180 degrees. So say I want maindrain vs. skimmer flow at say 25/75%, and since I know the state of the 1st relay, I know which direction the actuator will be traveling. Depending of direction I cut the power to the actuator after either 9 seconds or 27 seconds and it stops where I want it. If the timing gets out of whack (like after multiple relative moves, as my setup has about 20-50ms lag) and I eventually need to resync the position actuator, I can power the actuator on for 36 seconds and I know it will be at the endpoint which the first relay controls.

Again super interesting work on the alternate firmware, just wanted to share an alternative for those who do not have these valves.

bluemantwo commented 11 months ago

@jeffegg , still having problems reliably talking to valves for firmware update. I run the firmware updater (0.3.2), and it puts my valve (firmware 0.3.1) into all red lights blinking mode. So it is talking to it. But it never finds the valve in the list, always giving "Valve Not Found". I did get it to find it once out of about 20 tries, but it failed in updating to 0.3.2. Tried power cycling but no joy there either. Very strange.

I tried using another RS485 adapter just in case that was the issue, but same result.

Now have 2 valves stuck in red/green/blue flashy mode and not responding to anything. I might stand down for a bit to see if anyone else is having issues or if it might be unique to my setup. If you do have instructions for restoring bricked valve, let me know and I will try it.

Also, I see that on 0.3.1, the valve rotate buttons are working in Service mode, but the directions are reversed.

jeffegg commented 11 months ago

V0.3.2, I released last night fixes a communication issue on the transmit path that could be your problem. After this I reliably see all my valves working. I also have this working in my production environment now. Ok I'm not sure what is happening to your valves. I'm flashing 4 valves in my setup without seeing failures. Can you describe your setup, cable lengths, how you do connections, cable types, etc? I do recognize my setup is a best case on my desk with minimal EMI. Can you describe the stuck valves? Does it flash blue for like 30 seconds, then turn to auto mode (green led) and then show all the red position LEDs. I'm recommend maybe keeping it to 1 valve right now connected to the rs485. The valve updater is something I've spent only a little time on, let me make it a bit better with some logging for me, and better prompts, etc.

Did your write the UUID of your valves down? If not I recommend this in the future it may help.

bluemantwo commented 11 months ago

The bricked valves both flash blue (set) light 4 times (about 2-3 seconds total) and then go into all 3 mode lights flashing at same time (Auto, Set, Service). I am pretty sure I know the UUID of each valve from log files I kept.

My set up is on my bench indoors (not connected to any other pool equipment). Raspberry Pi 3+, latest bulleye update, python 3.9.2. 24VAC transformer to valves (black, red, with white no connection), green to negative, yellow to positive of RS485 USB stick. No other programs starting (REM, njsPC, etc are disabled).

bluemantwo commented 11 months ago

For the Valve with 0.3.1 firmware on it, when I try to connect, all the RED LEDS that show position flash at once (0-24 positions) indicating that the valve is getting communications, but it never shows up in the list. Here is what I get when I try:

pi@pool3 ~/fwupdate/EggysIVFW-0.3.2/SW/IntelliValveFWUpdater $ python Python 3.9.2 (default, Mar 12 2021, 04:06:34) [GCC 10.2.1 20210110] on linux Type "help", "copyright", "credits" or "license" for more information.

import main fwu = main.FWUpdater() fwu.fw_updater() Index Device Product Serial # HW ID


1 /dev/ttyUSB0 USB2.0-Serial USB VID:PID=1A86:7523 LOCATION=1-1.4 2 /dev/ttyAMA0 3f201000.serial Default RS485 device is (hit enter to select): /dev/ttyUSB1 Please select the index of your RS485 device: 1 Device /dev/ttyUSB1 was selected. Opening serial port: /dev/ttyUSB0 Forcing all address reset on all Pentair FW Valves Waiting 5 seconds for message to send and valves to quiet a bit Sending ID valves packet to Valves with Eggy's Intellivalve Firmware Waiting 5 seconds for message to send and valves to quiet a bit Listening to /dev/ttyUSB0 for 30 seconds. Closing Serial Port: /dev/ttyUSB0

Index ID Tag Name Prerelease Publish Date Has FW release


  1  0x6f1bd70  v0.3.2  Version 0.3.2 - alpha release              False         2023-08-12T09:32:25Z  True
  2  0x6e8471f  v0.3.1  Version 0.3.1 - alpha release              False         2023-08-10T08:44:49Z  True
  3  0x6e143a2  v0.3.0  Version 0.3.0 - alpha release              False         2023-08-07T08:35:13Z  True
  4  0x6e061ac  v0.2.5  Version 0.2.5 - alpha release              False         2023-08-06T08:52:58Z  True
  5  0x6d4d280  v0.2.4  Version 0.2.4 - alpha release              False         2023-08-01T08:05:07Z  True
  6  0x6d24623  v0.2.3  Version 0.2.3 - alpha release              False         2023-07-31T07:37:27Z  True
  7  0x6d17d0f  v0.2.2  Version 0.2.2 - alpha release - test only  True          2023-07-30T08:29:35Z  True
  8  0x6bf8208  v0.2.1  Version 0.2.1 - alpha release              False         2023-07-23T07:46:43Z  True
  9  0x6bf0a14  v0.2.0  Version 0.2.0 - alpha release              True          2023-07-22T08:25:46Z  True
 10  0x6a53e25  v0.1.1  Version 0.1.1 - Pre-Alpha Release          True          2023-07-08T09:17:30Z  True
 11  0x6a5364e  v0.1.0  Version 0.1.0 - Pre-Alpha Release          True          2023-07-08T07:48:16Z  True
 12  0x68b86f1  v0.0.1  DirtyUnsupportedFW                         True          2023-06-25T09:15:16Z  False
 13  0x5966af9  v0.0.0                                             True          2023-02-27T06:05:59Z  False

Please select the fw release: 1 Index Address UUID Git Hash Git Date Branch Tag DID RID


  1             Valve Not found  N/A

Please select the index of the Valve for FW update:

bluemantwo commented 11 months ago

I am trying to manual flash a firmware using the known UUID, but it is unclear if I am doing this correctly. See below:

Listening to /dev/ttyUSB0 for 30 seconds. Closing Serial Port: /dev/ttyUSB0

Index ID Tag Name Prerelease Publish Date Has FW release


  1  0x6f1bd70  v0.3.2  Version 0.3.2 - alpha release              False         2023-08-12T09:32:25Z  True
  2  0x6e8471f  v0.3.1  Version 0.3.1 - alpha release              False         2023-08-10T08:44:49Z  True
  3  0x6e143a2  v0.3.0  Version 0.3.0 - alpha release              False         2023-08-07T08:35:13Z  True
  4  0x6e061ac  v0.2.5  Version 0.2.5 - alpha release              False         2023-08-06T08:52:58Z  True
  5  0x6d4d280  v0.2.4  Version 0.2.4 - alpha release              False         2023-08-01T08:05:07Z  True
  6  0x6d24623  v0.2.3  Version 0.2.3 - alpha release              False         2023-07-31T07:37:27Z  True
  7  0x6d17d0f  v0.2.2  Version 0.2.2 - alpha release - test only  True          2023-07-30T08:29:35Z  True
  8  0x6bf8208  v0.2.1  Version 0.2.1 - alpha release              False         2023-07-23T07:46:43Z  True
  9  0x6bf0a14  v0.2.0  Version 0.2.0 - alpha release              True          2023-07-22T08:25:46Z  True
 10  0x6a53e25  v0.1.1  Version 0.1.1 - Pre-Alpha Release          True          2023-07-08T09:17:30Z  True
 11  0x6a5364e  v0.1.0  Version 0.1.0 - Pre-Alpha Release          True          2023-07-08T07:48:16Z  True
 12  0x68b86f1  v0.0.1  DirtyUnsupportedFW                         True          2023-06-25T09:15:16Z  False
 13  0x5966af9  v0.0.0                                             True          2023-02-27T06:05:59Z  False

Please select the fw release: 1 Index Address UUID Git Hash Git Date Branch Tag DID RID


  1             Valve Not found  N/A

Please select the index of the Valve for FW update: 1 Please enter the valve UUID in format xx-yy-zz-uu-tt-ss: 80-34-28-28-21-59 Enter Eggy's FW for new valve FW or Pentairs's FW for pentair FW: ????What do I put here????? Enter Address in Hex format (i.e. 0xA0): 0xB3 Valve 80-34-28-28-21-59 was selected. Reallocated Valve Address if needed

I was not sure what to put for the "Enter Firmware" question.

jeffegg commented 11 months ago

Enter either of the two: Eggy's FW Pentairs's FW

If you don't see the valves enter FW update mode move to blue blinking mode light when commanded you will need to do this manually by power cycling the valve.

bluemantwo commented 11 months ago

OK, that is what I was doing. Here is what happens:

The valve goes into all red lights flashing mode after "lease select the index of your RS485 device: 1"

It then goes into the mode where it is trying to flash the firmware, after entering "Enter Address in Hex format (i.e. 0xA0): 0xA0"

I then power cycle the valve, and it goes into blinky blue mode, with the 0 LED lit, indicating it is ready for programming. Then nothing happens. It just tries then quits. See terminal log below:

fwu.fw_updater() Index Device Product Serial # HW ID


1 /dev/ttyUSB0 USB2.0-Serial USB VID:PID=1A86:7523 LOCATION=1-1.2 2 /dev/ttyAMA0 3f201000.serial Default RS485 device is (hit enter to select): /dev/ttyUSB0 Please select the index of your RS485 device: 1 Device /dev/ttyUSB0 was selected. Opening serial port: /dev/ttyUSB0 Forcing all address reset on all Pentair FW Valves Waiting 5 seconds for message to send and valves to quiet a bit Sending ID valves packet to Valves with Eggy's Intellivalve Firmware Waiting 5 seconds for message to send and valves to quiet a bit Listening to /dev/ttyUSB0 for 30 seconds. Closing Serial Port: /dev/ttyUSB0

Index ID Tag Name Prerelease Publish Date Has FW release


  1  0x6f1bd70  v0.3.2  Version 0.3.2 - alpha release              False         2023-08-12T09:32:25Z  True
  2  0x6e8471f  v0.3.1  Version 0.3.1 - alpha release              False         2023-08-10T08:44:49Z  True
  3  0x6e143a2  v0.3.0  Version 0.3.0 - alpha release              False         2023-08-07T08:35:13Z  True
  4  0x6e061ac  v0.2.5  Version 0.2.5 - alpha release              False         2023-08-06T08:52:58Z  True
  5  0x6d4d280  v0.2.4  Version 0.2.4 - alpha release              False         2023-08-01T08:05:07Z  True
  6  0x6d24623  v0.2.3  Version 0.2.3 - alpha release              False         2023-07-31T07:37:27Z  True
  7  0x6d17d0f  v0.2.2  Version 0.2.2 - alpha release - test only  True          2023-07-30T08:29:35Z  True
  8  0x6bf8208  v0.2.1  Version 0.2.1 - alpha release              False         2023-07-23T07:46:43Z  True
  9  0x6bf0a14  v0.2.0  Version 0.2.0 - alpha release              True          2023-07-22T08:25:46Z  True
 10  0x6a53e25  v0.1.1  Version 0.1.1 - Pre-Alpha Release          True          2023-07-08T09:17:30Z  True
 11  0x6a5364e  v0.1.0  Version 0.1.0 - Pre-Alpha Release          True          2023-07-08T07:48:16Z  True
 12  0x68b86f1  v0.0.1  DirtyUnsupportedFW                         True          2023-06-25T09:15:16Z  False
 13  0x5966af9  v0.0.0                                             True          2023-02-27T06:05:59Z  False

Please select the fw release: 1 Index Address UUID Git Hash Git Date Branch Tag DID RID


  1             Valve Not found  N/A

Please select the index of the Valve for FW update: 1 Please enter the valve UUID in format xx-yy-zz-uu-tt-ss: 80-34-28-28-21-59 Enter Eggy's FW for new valve FW or Pentairs's FW for pentair FW: Eggy's FW Enter Address in Hex format (i.e. 0xA0): 0xA0 Valve 80-34-28-28-21-59 was selected. Reallocated Valve Address if needed

Opening serial port: /dev/ttyUSB0 Forcing valve address: 0xa0 uuid: 80-34-28-28-21-59 to reset Closing Port Setting valve 80-34-28-28-21-59 to 0xa0 Setting valve 80-34-28-28-21-59 to 0xa0 Opening serial port: /dev/ttyUSB0 programming 0x0F80 Unexpected packet read: vs ff-00-ff-a5-01-10-a0-01-01-f5 on line {'byte_count': 64, 'address': '0F80', 'data': '8731CB2FFF34FF347E148731AF313C2787317E10090020000308A0008F317B2F2200B9002200BA01F62F22003A082200B700B801370822003407860022003808', 'checksum': None} retry 0 of 10 and retry of retry 0 Setting valve 80-34-28-28-21-59 to 0xa0 Setting valve 80-34-28-28-21-59 to 0xa0 programming 0x0F80 Unexpected packet read: vs ff-00-ff-a5-01-10-a0-01-01-f5 on line {'byte_count': 64, 'address': '0F80', 'data': '8731CB2FFF34FF347E148731AF313C2787317E10090020000308A0008F317B2F2200B9002200BA01F62F22003A082200B700B801370822003407860022003808', 'checksum': None} retry 1 of 10 and retry of retry 1 Setting valve 80-34-28-28-21-59 to 0xa0 Setting valve 80-34-28-28-21-59 to 0xa0 programming 0x0F80 Unexpected packet read: vs ff-00-ff-a5-01-10-a0-01-01-f5 on line {'byte_count': 64, 'address': '0F80', 'data': '8731CB2FFF34FF347E148731AF313C2787317E10090020000308A0008F317B2F2200B9002200BA01F62F22003A082200B700B801370822003407860022003808', 'checksum': None} retry 2 of 10 and retry of retry 2 Setting valve 80-34-28-28-21-59 to 0xa0 Setting valve 80-34-28-28-21-59 to 0xa0 programming 0x0F80 Unexpected packet read: vs ff-00-ff-a5-01-10-a0-01-01-f5 on line {'byte_count': 64, 'address': '0F80', 'data': '8731CB2FFF34FF347E148731AF313C2787317E10090020000308A0008F317B2F2200B9002200BA01F62F22003A082200B700B801370822003407860022003808', 'checksum': None} retry 3 of 10 and retry of retry 3 Setting valve 80-34-28-28-21-59 to 0xa0 Setting valve 80-34-28-28-21-59 to 0xa0 programming 0x0F80 Unexpected packet read: vs ff-00-ff-a5-01-10-a0-01-01-f5 on line {'byte_count': 64, 'address': '0F80', 'data': '8731CB2FFF34FF347E148731AF313C2787317E10090020000308A0008F317B2F2200B9002200BA01F62F22003A082200B700B801370822003407860022003808', 'checksum': None} retry 4 of 10 and retry of retry 4 Setting valve 80-34-28-28-21-59 to 0xa0 Setting valve 80-34-28-28-21-59 to 0xa0 programming 0x0F80 Unexpected packet read: vs ff-00-ff-a5-01-10-a0-01-01-f5 on line {'byte_count': 64, 'address': '0F80', 'data': '8731CB2FFF34FF347E148731AF313C2787317E10090020000308A0008F317B2F2200B9002200BA01F62F22003A082200B700B801370822003407860022003808', 'checksum': None} retry 5 of 10 and retry of retry 5 Setting valve 80-34-28-28-21-59 to 0xa0 Setting valve 80-34-28-28-21-59 to 0xa0 programming 0x0F80 Unexpected packet read: vs ff-00-ff-a5-01-10-a0-01-01-f5 on line {'byte_count': 64, 'address': '0F80', 'data': '8731CB2FFF34FF347E148731AF313C2787317E10090020000308A0008F317B2F2200B9002200BA01F62F22003A082200B700B801370822003407860022003808', 'checksum': None} retry 6 of 10 and retry of retry 6 Setting valve 80-34-28-28-21-59 to 0xa0 Setting valve 80-34-28-28-21-59 to 0xa0 programming 0x0F80 Unexpected packet read: vs ff-00-ff-a5-01-10-a0-01-01-f5 on line {'byte_count': 64, 'address': '0F80', 'data': '8731CB2FFF34FF347E148731AF313C2787317E10090020000308A0008F317B2F2200B9002200BA01F62F22003A082200B700B801370822003407860022003808', 'checksum': None} retry 7 of 10 and retry of retry 7 Setting valve 80-34-28-28-21-59 to 0xa0 Setting valve 80-34-28-28-21-59 to 0xa0 programming 0x0F80 Unexpected packet read: vs ff-00-ff-a5-01-10-a0-01-01-f5 on line {'byte_count': 64, 'address': '0F80', 'data': '8731CB2FFF34FF347E148731AF313C2787317E10090020000308A0008F317B2F2200B9002200BA01F62F22003A082200B700B801370822003407860022003808', 'checksum': None} retry 8 of 10 and retry of retry 8 Setting valve 80-34-28-28-21-59 to 0xa0 Setting valve 80-34-28-28-21-59 to 0xa0 programming 0x0F80 Unexpected packet read: vs ff-00-ff-a5-01-10-a0-01-01-f5 on line {'byte_count': 64, 'address': '0F80', 'data': '8731CB2FFF34FF347E148731AF313C2787317E10090020000308A0008F317B2F2200B9002200BA01F62F22003A082200B700B801370822003407860022003808', 'checksum': None} retry 9 of 10 and retry of retry 9 Setting valve 80-34-28-28-21-59 to 0xa0 Setting valve 80-34-28-28-21-59 to 0xa0 programming 0x0F80 Unexpected packet read: vs ff-00-ff-a5-01-10-a0-01-01-f5 on line {'byte_count': 64, 'address': '0F80', 'data': '8731CB2FFF34FF347E148731AF313C2787317E10090020000308A0008F317B2F2200B9002200BA01F62F22003A082200B700B801370822003407860022003808', 'checksum': None} Packet never sent after 10 retries exiting. Valve will be in a bad state.Please try to quiet RS485 and/or increase retries Trying to force exit FW mode, sleeping for 20 seconds Sleeping another 5 seconds

At this point it exist blinky blue mode and returns to normal Auto mode.

jeffegg commented 11 months ago

I can see this being an issue, can you try with address 0xC instead? When the valve resets in the bootloader 0xc is the address I suspect this could be the issue there. I'm working on a better flashing routine to work though any of these issues but will take some time.

bluemantwo commented 11 months ago

Tried 0xc but same result

Originally, after flashing 0.2.1, it was 0xB3. Tried that as well and no joy.

Again, no rush on this. I just had some spare cycles and was trying different things with it. This does not impact my production environment in any way.

jeffegg commented 11 months ago

Hmm this is really odd, its like the valve isn't talking at all but the bootloader should be talking, this is code that I don't/cannot change. But something odd is happening, Last experiment I can think of, I just tried this and it works, I've attached the updater FW as I have it now. 1) Remove power from valves (best to only use the valve you want to program if possible) 2) Start the FW updater 3) Do the valve not found routine 4) Enter the following Valves UUID Eggy's FW 0xA0 address is fine: 5) Give power to valve when you see Waiting to see valve with uuid: xx-xx-xx-xx-xx-xx reset 6) You should see Valve looks to have reset Sending Packet to address: 0xa0 uuid: 44-b7-d0-c9-cf-f4 to keed device in bootloader mode

Then it should flash IntelliValveFWUpdater.zip

bluemantwo commented 11 months ago

Bingo! Good flash (only took 30 seconds or so!) and now identifies just fine. Yes!!!

I might give a try with the Valve that is bricked to see if that procedure works on it. THANKS!!!

bluemantwo commented 11 months ago

No luck with the valve that has flashing bottom 3 LEDS (Auto/off, Set, Service). It does flash SET blue led 4 times when powering it up, but I cannot get it to enter firmware flash mode.

jeffegg commented 11 months ago

@bluemantwo I'm willing to trade you a good valve for that one, so I can see what is going on there. I can get the logic analyzer on there to see what is happening and pull/debug the FW. The only thing I can think of is that the EEPROM was corrupted.There is 1 more possibility, I need to look at the bootloader tonight, there is an override if I remember when you hold the save button on valve power up. I cannot remember what it does but maybe still a recovery path available