Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AC charger: make CAN controller frequency configurable #500

Merged
merged 1 commit into from
Oct 19, 2023

Conversation

schlimmchen
Copy link
Member

@schlimmchen schlimmchen commented Oct 15, 2023

This change makes it possible to set the quarz frequency assumed by the MCP CAN controller driver software. It must know the frequency of the actual quarz installed, so the baud rate can be setup accordingly through the respective prescaler register on the CAN controller.

Closes #485.

@schlimmchen schlimmchen force-pushed the huawei-charger-frequency branch from f645adc to 0348ff6 Compare October 16, 2023 18:04
@schlimmchen schlimmchen marked this pull request as ready for review October 16, 2023 18:06
@MalteSchm
Copy link

Thumbs up!

@helgeerbe helgeerbe merged commit 4d4aadf into hoylabs:development Oct 19, 2023
@schlimmchen schlimmchen deleted the huawei-charger-frequency branch October 19, 2023 14:44
@helgeerbe
Copy link
Collaborator

@schlimmchen I have problems with the actual development branch b833d5a
The live view disapears after a while. Can you check, if /api/livedata/status works. I have no time in the moment to do deeper investigations. But calling /api/livedata/status returns null on my browser. So I don't get a json response.

@schlimmchen
Copy link
Member Author

@helgeerbe I can probably find some time this evening.

@schlimmchen
Copy link
Member Author

The live view disapears after a while.

Can you describe "a while" better? Five minutes? An hour?

How's your heap usage when you observe the issue?

How many inverters do you have configured?

I'll watch my test system. Currently I cannot reproduce this.

@helgeerbe
Copy link
Collaborator

Hard to tell. I would say within 15 minutes. Everything is normal, values are transmitted over MQTT. Heap and console log looks fine.

I have two inverters. What I noticed I buted in low light condition. And even my uncontrolled inverter was up. But I didn't see the limit. Everything was 0. This inverter has a fixed limit of 600 W. The data of the inverter were never refreshed, while the mppt values were updated ever 3 second.

No it is complete dark and the live view is back.

philippsandhaus pushed a commit to philippsandhaus/OpenDTU-OnBattery that referenced this pull request Oct 20, 2023
@schlimmchen
Copy link
Member Author

I (still) can't see any issues... @philippsandhaus Have you deployed a firmware based on the current helgeerbe/development branch on your productive system? Do you observe any issues with the inverter live view?

@schlimmchen
Copy link
Member Author

I do see this:

Screenshot from 2023-10-21 20-21-03

After booting a new firmware (updated using the serial connection), the limit of the battery-powered HM-1500 is not updated. It should be 30W. That seems like a glitch, though. Not really troublesome. I guess that it will heal when I set a new limit manually.

Oh, wait, there it is:

Screenshot from 2023-10-21 20-24-23

That must have been the last power limit before the firmware update. The inverter is now shut down because before the firmware update the battery was discharging after reaching the start threshold but not the stop threshold yet.

It should still be 30W. The DPL should have sent a limit of 30W and then shut down the inverter... Meh... Still, I see no issues with the live view.

@philippsandhaus
Copy link

I (still) can't see any issues... @philippsandhaus Have you deployed a firmware based on the current helgeerbe/development branch on your productive system? Do you observe any issues with the inverter live view?

No problem at my setup. I use the current development branch on my production system, yes.

@schlimmchen
Copy link
Member Author

schlimmchen commented Oct 22, 2023

Oh crap...

ERROR: MPPT controller index 0 is out of bounds (0 controllers)
Guru Meditation Error: Core  1 panic'ed (LoadProhibited). Exception was unhandled.

Core  1 register dump:
PC      : 0x4010a2f1  PS      : 0x00060530  A0      : 0x8010a912  A1      : 0x3ffe81f0  
A2      : 0x3f435ddb  A3      : 0x3ffc497c  A4      : 0x00000000  A5      : 0x3f440595  
A6      : 0x3ffec6c4  A7      : 0x3ffec6e4  A8      : 0x8010a2d1  A9      : 0x3ffe81d0  
A10     : 0x00000230  A11     : 0x3f440595  A12     : 0x00000000  A13     : 0x3ffe2418  
A14     : 0x3ffec6d4  A15     : 0x00000000  SAR     : 0x0000001f  EXCCAUSE: 0x0000001c  
EXCVADDR: 0x00000064  LBEG    : 0x4008c06d  LEND    : 0x4008c07d  LCOUNT  : 0xffffffff  

Backtrace: 0x4010a2ee:0x3ffe81f0 0x4010a90f:0x3ffe8470 0x401e1c6d:0x3ffe84b0 0x4011b405:0x3ffe84d0 0x40118945:0x3ffe8520 0x40118c81:0x3ffe8570 0x40118e81:0x3ffe85c0 0x401c2aad:0x3ffe85e0 0x40
1c2b25:0x3ffe8610 0x401c32f2:0x3ffe8630

ELF file SHA256: 05fa821302576645

I am so sorry! I don't know why this happens yet, except for that it must have something to do with VE.Direct being disabled altogether, but this is an issue with #505.

However, I am also confused... @helgeerbe Did you test this on a system without VE.Direct and saw the issue there? As far as I know you do use VE.Direct, at least on your productive system?

See #516.

@helgeerbe
Copy link
Collaborator

@schlimmchen no I test it on my productive system. So VE.Direct is always enabled. But I have the same issue that the limits are zero after flashing the bin.

I just rebooted the esp:

Solar is my unmanaged inverter. Limit should be 600W
image

Luna is my managed inverter:

image

While MPPT data age is updated every 3 seconds, live data of the inverter is never updated (only the data age counter). I have to manually reload the whole page. Then inverter data is updated then only once.

@schlimmchen
Copy link
Member Author

Hm. Well, I can confirm that it takes a long time until the limit is fetched from the inverter such that the UI shows it correctly. But it does happen after a while. Around five minutes of uptime as I just tested. That's an annoying glitch and I don't know it that's new, to be honest.

Now for your other issue: It sounds to me like the API endpoint works (that's why you get any data at all and new data when reloading the page) but the websocket does not (that's why no new data is pushed automatically). Does that make sense, can you comment on this? Maybe it's wrong because you said earlier that /api/livedata/status does not return data. In that case I would expect that you see no inverter live view data at all. Are we past that?

I cannot reproduce any of this. My live view always works as expected.

Your device does not reboot after accessing the web app once? What do you see when using websocat from https://github.com/vi/websocat/ like so: websocat ws://<hostname>/livedata?

@helgeerbe
Copy link
Collaborator

@schlimmchen

wscat -c "ws://admin:mypassword@opendtu/livedata" 
Connected (press CTRL+C to quit)
< {}
< {}
< {}
< {}
< {}
< {}
< {}
< {}
< {}
< {}
< {}
< {}

When I use vedirectlivedata instead I get the json data from vedirect.

@helgeerbe
Copy link
Collaborator

Hope I fixed it with 49a1030

When I unrolled upstream merge, there was a code duplication left, which allocated the json buffer twice. I also enlarge the buffer from 4096 * Inverter Max Count to 4200 * Inverter Max Count

@schlimmchen
Copy link
Member Author

Glad that you pinned it down 💪

Copy link

github-actions bot commented Apr 4, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new discussion or issue for related concerns.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Request] Add Support for MCP2515 CAN moduls with 16Mhz Oscillator frequency
4 participants