fatyogi / epever-upower-tracer

Linux/Raspberry monitoring scripts for EPsolar UPower hybrid invertors and EPever Tracer charge controllers
Apache License 2.0
29 stars 14 forks source link

Add support for USB/RS485 cable ID 1a86:55d3 QinHeng Electronics. Add ControllerTemp register. #7

Open bkuschak opened 1 year ago

bkuschak commented 1 year ago

Manufacturer: EPEVER Model: CC-USB-RS485-150U

Tested on old Beaglebone Green: 4.19.94-ti-r42 #1buster SMP PREEMPT Tue Mar 31 19:38:29 UTC 2020 armv7l GNU/Linux

Git-Me-Some-Hub commented 5 months ago

I am seeing this commit and as I have the same version of the Epever RS485 cable I am wondering if you had any issues getting a driver installed. When I install the driver from the Repo, or from the website (current) I am unable to get the /dev/tty** to assign properly. When I do a default Pi setup I see in dmesg: cdc_acm 1-1.5:1.0: ttyACM0: USB ACM device

Do you have to do anything special to get that version to load properly, and or does it still use the driver that is bundled?

dmesg: usb 1-1.4: New USB device found, idVendor=1a86, idProduct=55d3, bcdDevice= 4.43 lsusb" Bus 001 Device 006: ID 1a86:55d3 QinHeng Electronics

fatyogi commented 5 months ago

If you are using the original EPEVER cable - you'll have to block the load of the ACM0 driver, because it will be conflicting with the Exar driver

Please check the Makefile in the Exar driver directory (for your Linux kernel) - under "install:" there is a step to blacklist the ACM driver by adding it into the kernel blacklist file

On Wed, 3 Jul 2024 at 09:41, Git-Me-Some-Hub @.***> wrote:

I am seeing this commit and as I have the same version of the Epever RS485 cable I am wondering if you had any issues getting a driver installed. When I install the driver from the Repo, or from the website (current) I am unable to get the /dev/tty** to assign properly. When I do a default Pi setup I see in dmesg: cdc_acm 1-1.5:1.0: ttyACM0: USB ACM device

Do you have to do anything special to get that version to load properly, and or does it still use the driver that is bundled?

— Reply to this email directly, view it on GitHub https://github.com/fatyogi/epever-upower-tracer/pull/7#issuecomment-2204501948, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4YYO4QCPLFG6PL5D37IVLZKMNA3AVCNFSM6AAAAABKILACBKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBUGUYDCOJUHA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Git-Me-Some-Hub commented 4 months ago

I do appreciate the comment, and I can confirm the blacklist file is under /etc/modprobe.d/. However, I do believe I ordered a replacement cable off Amazon. The reason I am posting on this commit is because I am not getting the same device ID that you, @fatyogi were listing, but what @bkuschak was from QinHeng Electronics. As such I thought this might be the best method to inquire on any additional steps that the user might have needed to complete setup. I am kind of hitting my head against the wall at this point. Not sure if there is another driver to install, or I am just totally botching this.

Note: I do not see a /dev/ttyACM0, but do see a ttyAMA0

fatyogi commented 4 months ago

Hi there,

Apologies for the confusion with the device name.

I did a quick google on QinHeng drivers / it looks they are only available for Windows, unless you dig a bit deeper.

Sorry, I have zero experience with them! I suggest either talk to @bkuschak who seem to have gotten it to work, or contact QinHeng directly.

As a last resort, and to spare the forehead, I would just get the official Epever cable from AliExpress - they are inexpensive, should not set you back more than 15-20 bucks, and they tend to work well with Exar drivers provided in the project. I am using two of those cables and they never let me down.

// Laconic style, sent from my phone

On Fri, 12 Jul 2024 at 13:52, Git-Me-Some-Hub @.***> wrote:

I do appreciate the comment, and I can confirm the blacklist file is under /etc/modprobe.d/. However, I do believe I ordered a replacement cable off Amazon. The reason I am posting on this commit is because I am not getting the same device ID that you, @fatyogi https://github.com/fatyogi were listing, but what @bkuschak https://github.com/bkuschak was from QinHeng Electronics. As such I thought this might be the best method to inquire on any additional steps that the user might have needed to complete setup. I am kind of hitting my head against the wall at this point. Not sure if there is another driver to install, or I am just totally botching this.

Note: I do not see a /dev/ttyACM0, but do see a ttyAMA0

— Reply to this email directly, view it on GitHub https://github.com/fatyogi/epever-upower-tracer/pull/7#issuecomment-2224273667, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4YYO2Z273X5LFP3JNLY2LZL4ZHNAVCNFSM6AAAAABKILACBKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRUGI3TGNRWG4 . You are receiving this because you were mentioned.Message ID: @.***>

fatyogi commented 4 months ago

Hey, do you want to try changing the configuration line in the .conf file from

/dev/ttyXR00 to /dev/ttyAMA0 ?

I’m sure you have done this before but just double checking…

// Laconic style, sent from my phone

On Fri, 12 Jul 2024 at 13:52, Git-Me-Some-Hub @.***> wrote:

I do appreciate the comment, and I can confirm the blacklist file is under /etc/modprobe.d/. However, I do believe I ordered a replacement cable off Amazon. The reason I am posting on this commit is because I am not getting the same device ID that you, @fatyogi https://github.com/fatyogi were listing, but what @bkuschak https://github.com/bkuschak was from QinHeng Electronics. As such I thought this might be the best method to inquire on any additional steps that the user might have needed to complete setup. I am kind of hitting my head against the wall at this point. Not sure if there is another driver to install, or I am just totally botching this.

Note: I do not see a /dev/ttyACM0, but do see a ttyAMA0

— Reply to this email directly, view it on GitHub https://github.com/fatyogi/epever-upower-tracer/pull/7#issuecomment-2224273667, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4YYO2Z273X5LFP3JNLY2LZL4ZHNAVCNFSM6AAAAABKILACBKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRUGI3TGNRWG4 . You are receiving this because you were mentioned.Message ID: @.***>

bkuschak commented 4 months ago

What platform are you running on?  You may need to blacklist the AMA driver.Run 'dmesg |less' and search for messages related to tty to see what driver is being loaded for ttyAMA0.   Run 'lsmod' to see the loaded modules.  You might see one like 'uart-pl011' or similar.  If so try blacklisting it.

On Thursday, July 11, 2024 at 07:57:23 PM PDT, Olaf Andersen ***@***.***> wrote:  

Hey, do you want to try changing the configuration line in the .conf file from

/dev/ttyXR00 to /dev/ttyAMA0 ?

I’m sure you have done this before but just double checking…

// Laconic style, sent from my phone

On Fri, 12 Jul 2024 at 13:52, Git-Me-Some-Hub @.***> wrote:

I do appreciate the comment, and I can confirm the blacklist file is under /etc/modprobe.d/. However, I do believe I ordered a replacement cable off Amazon. The reason I am posting on this commit is because I am not getting the same device ID that you, @fatyogi https://github.com/fatyogi were listing, but what @bkuschak https://github.com/bkuschak was from QinHeng Electronics. As such I thought this might be the best method to inquire on any additional steps that the user might have needed to complete setup. I am kind of hitting my head against the wall at this point. Not sure if there is another driver to install, or I am just totally botching this.

Note: I do not see a /dev/ttyACM0, but do see a ttyAMA0

— Reply to this email directly, view it on GitHub https://github.com/fatyogi/epever-upower-tracer/pull/7#issuecomment-2224273667, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4YYO2Z273X5LFP3JNLY2LZL4ZHNAVCNFSM6AAAAABKILACBKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRUGI3TGNRWG4 . You are receiving this because you were mentioned.Message ID: @.***>

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

Git-Me-Some-Hub commented 4 months ago

Thanks for the update @bkuschak - I did what you said, and I am certainly seeing that driver being loaded, but for some reason I am not getting the driver to be properly blacklisted. I am just not seeing it under lsmod, nor the correct name.

I am running a PI-3, Raspbian Kernel: 5.10

dmesg | grep serial [ 2.909667] uart-pl011 3f201000.serial: cts_event_workaround enabled [ 2.909778] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 114, base_baud = 0) is a PL011 rev2 [ 10.676813] uart-pl011 3f201000.serial: no DMA platform data

dmesg | grep Serial [ 0.045299] Serial: AMBA PL011 UART driver [ 2.879964] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 2.880008] usb usb1: SerialNumber: 3f980000.usb [ 3.455186] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3.905086] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 4.579205] usb 1-1.3: New USB device strings: Mfr=0, Product=2, SerialNumber=3 [ 4.579222] usb 1-1.3: Product: USB Single Serial [ 4.579237] usb 1-1.3: SerialNumber: 545C038723

sudo nano /etc/modprobe.d/blacklist-uart-pl011.conf

blacklist uart-pl011

I will note that this is not really my wheel-house in the linux world, I am usually totally fine just running normal software on top, networking, and the like. drivers and such....oooaafff.

Mor information: lsmod Module Size Used by cmac 16384 1 fuse 126976 3 rfcomm 49152 4 bnep 20480 2 hci_uart 40960 1 btbcm 16384 1 hci_uart bluetooth 393216 29 hci_uart,bnep,btbcm,rfcomm 8021q 32768 0 ecdh_generic 16384 2 bluetooth ecc 40960 1 ecdh_generic garp 16384 1 8021q stp 16384 1 garp llc 16384 2 garp,stp brcmfmac 327680 0 brcmutil 20480 1 brcmfmac sha256_generic 16384 0 cfg80211 761856 1 brcmfmac rfkill 32768 6 bluetooth,cfg80211 raspberrypi_hwmon 16384 0 bcm2835_v4l2 40960 0 snd_bcm2835 24576 3 bcm2835_codec 40960 0 bcm2835_isp 32768 0 v4l2_mem2mem 36864 1 bcm2835_codec videobuf2_vmalloc 16384 1 bcm2835_v4l2 bcm2835_mmal_vchiq 32768 3 bcm2835_isp,bcm2835_codec,bcm2835_v4l2 snd_pcm 110592 1 snd_bcm2835 videobuf2_dma_contig 20480 2 bcm2835_isp,bcm2835_codec videobuf2_memops 16384 2 videobuf2_dma_contig,videobuf2_vmalloc videobuf2_v4l2 32768 4 bcm2835_isp,bcm2835_codec,bcm2835_v4l2,v4l2_mem2 mem snd_timer 32768 1 snd_pcm videobuf2_common 61440 5 bcm2835_isp,bcm2835_codec,bcm2835_v4l2,v4l2_mem2 mem,videobuf2_v4l2 snd 77824 9 snd_timer,snd_bcm2835,snd_pcm videodev 249856 6 bcm2835_isp,bcm2835_codec,videobuf2_common,bcm28 35_v4l2,v4l2_mem2mem,videobuf2_v4l2 vc_sm_cma 32768 2 bcm2835_isp,bcm2835_mmal_vchiq mc 45056 6 bcm2835_isp,bcm2835_codec,videobuf2_common,video dev,v4l2_mem2mem,videobuf2_v4l2 uio_pdrv_genirq 16384 0 uio 20480 1 uio_pdrv_genirq fixed 16384 0 i2c_dev 20480 0 ip_tables 28672 0 x_tables 32768 1 ip_tables ipv6 495616 42

What platform are you running on?  You may need to blacklist the AMA driver.Run 'dmesg |less' and search for messages related to tty to see what driver is being loaded for ttyAMA0.   Run 'lsmod' to see the loaded modules.  You might see one like 'uart-pl011' or similar.  If so try blacklisting it. On Thursday, July 11, 2024 at 07:57:23 PM PDT, Olaf Andersen @.> wrote: Hey, do you want to try changing the configuration line in the .conf file from /dev/ttyXR00 to /dev/ttyAMA0 ? I’m sure you have done this before but just double checking… // Laconic style, sent from my phone On Fri, 12 Jul 2024 at 13:52, Git-Me-Some-Hub @.> wrote: I do appreciate the comment, and I can confirm the blacklist file is under /etc/modprobe.d/. However, I do believe I ordered a replacement cable off Amazon. The reason I am posting on this commit is because I am not getting the same device ID that you, @fatyogi https://github.com/fatyogi were listing, but what @bkuschak https://github.com/bkuschak was from QinHeng Electronics. As such I thought this might be the best method to inquire on any additional steps that the user might have needed to complete setup. I am kind of hitting my head against the wall at this point. Not sure if there is another driver to install, or I am just totally botching this. Note: I do not see a /dev/ttyACM0, but do see a ttyAMA0 — Reply to this email directly, view it on GitHub <#7 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4YYO2Z273X5LFP3JNLY2LZL4ZHNAVCNFSM6AAAAABKILACBKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRUGI3TGNRWG4 . You are receiving this because you were mentioned.Message ID: @.> — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.>

bkuschak commented 4 months ago

If your system is running an initial ramdisk at boot time, you may need to update the ramdisk files as well. sudo update-initramfs -u  However, lsmod shows that uart-pl011 is not loaded as a module.  This driver is probably compiled into the kernel rather than being a loadable module.  If so I see three options: 1) add something to the kernel command line to disable that driver, or 2) after booting use sysfs to unbind that driver, or 3) recompile your kernel without that driver enabled (or switch it to module instead of being compiled in).  Here's an example of #1.  You would add something like "initcall_blacklist=pl011_init" to the kernel command line.  This can be done by editing the file /boot/firmware/cmdline.txt.  Then reboot.https://unix.stackexchange.com/a/474552 https://github.com/raspberrypi/documentation/blob/develop/documentation/asciidoc/computers/configuration/kernel-command-line-config.adoc

Alternatively, here are some examples of #2.  These are not exactly what you need, but they might get you pointed in the right direction.https://unix.stackexchange.com/a/599711 https://unix.stackexchange.com/a/13035

Brian On Sunday, July 14, 2024 at 10:27:20 PM PDT, Git-Me-Some-Hub @.***> wrote:

Thanks for the update @bkuschak - I did what you said, and I am certainly seeing that driver being loaded, but for some reason I am not getting the driver to be properly blacklisted. I am just not seeing it under lsmod, nor the correct name.

I am running a PI-3, Raspbian Kernel: 5.10

dmesg | grep serial [ 2.909667] uart-pl011 3f201000.serial: cts_event_workaround enabled [ 2.909778] 3f201000.serial: ttyAMA0 at MMIO 0x3f201000 (irq = 114, base_baud = 0) is a PL011 rev2 [ 10.676813] uart-pl011 3f201000.serial: no DMA platform data

dmesg | grep Serial [ 0.045299] Serial: AMBA PL011 UART driver [ 2.879964] usb usb1: New USB device strings: Mfr=3, Product=2, SerialNumber=1 [ 2.880008] usb usb1: SerialNumber: 3f980000.usb [ 3.455186] usb 1-1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 3.905086] usb 1-1.1: New USB device strings: Mfr=0, Product=0, SerialNumber=0 [ 4.579205] usb 1-1.3: New USB device strings: Mfr=0, Product=2, SerialNumber=3 [ 4.579222] usb 1-1.3: Product: USB Single Serial [ 4.579237] usb 1-1.3: SerialNumber: 545C038723

sudo nano /etc/modprobe.d/blacklist-uart-pl011.conf

blacklist uart-pl011

I will note that this is not really my wheel-house in the linux world, I am usually totally fine just running normal software on top, networking, and the like. drivers and such....oooaafff.

Mor information: lsmod Module Size Used by cmac 16384 1 fuse 126976 3 rfcomm 49152 4 bnep 20480 2 hci_uart 40960 1 btbcm 16384 1 hci_uart bluetooth 393216 29 hci_uart,bnep,btbcm,rfcomm 8021q 32768 0 ecdh_generic 16384 2 bluetooth ecc 40960 1 ecdh_generic garp 16384 1 8021q stp 16384 1 garp llc 16384 2 garp,stp brcmfmac 327680 0 brcmutil 20480 1 brcmfmac sha256_generic 16384 0 cfg80211 761856 1 brcmfmac rfkill 32768 6 bluetooth,cfg80211 raspberrypi_hwmon 16384 0 bcm2835_v4l2 40960 0 snd_bcm2835 24576 3 bcm2835_codec 40960 0 bcm2835_isp 32768 0 v4l2_mem2mem 36864 1 bcm2835_codec videobuf2_vmalloc 16384 1 bcm2835_v4l2 bcm2835_mmal_vchiq 32768 3 bcm2835_isp,bcm2835_codec,bcm2835_v4l2 snd_pcm 110592 1 snd_bcm2835 videobuf2_dma_contig 20480 2 bcm2835_isp,bcm2835_codec videobuf2_memops 16384 2 videobuf2_dma_contig,videobuf2_vmalloc videobuf2_v4l2 32768 4 bcm2835_isp,bcm2835_codec,bcm2835_v4l2,v4l2_mem2 mem snd_timer 32768 1 snd_pcm videobuf2_common 61440 5 bcm2835_isp,bcm2835_codec,bcm2835_v4l2,v4l2_mem2 mem,videobuf2_v4l2 snd 77824 9 snd_timer,snd_bcm2835,snd_pcm videodev 249856 6 bcm2835_isp,bcm2835_codec,videobuf2_common,bcm28 35_v4l2,v4l2_mem2mem,videobuf2_v4l2 vc_sm_cma 32768 2 bcm2835_isp,bcm2835_mmal_vchiq mc 45056 6 bcm2835_isp,bcm2835_codec,videobuf2_common,video dev,v4l2_mem2mem,videobuf2_v4l2 uio_pdrv_genirq 16384 0 uio 20480 1 uio_pdrv_genirq fixed 16384 0 i2c_dev 20480 0 ip_tables 28672 0 x_tables 32768 1 ip_tables ipv6 495616 42

What platform are you running on?  You may need to blacklist the AMA driver.Run 'dmesg |less' and search for messages related to tty to see what driver is being loaded for ttyAMA0.   Run 'lsmod' to see the loaded modules.  You might see one like 'uart-pl011' or similar.  If so try blacklisting it. On Thursday, July 11, 2024 at 07:57:23 PM PDT, Olaf Andersen @.> wrote: Hey, do you want to try changing the configuration line in the .conf file from /dev/ttyXR00 to /dev/ttyAMA0 ? I’m sure you have done this before but just double checking… // Laconic style, sent from my phone On Fri, 12 Jul 2024 at 13:52, Git-Me-Some-Hub @.> wrote: I do appreciate the comment, and I can confirm the blacklist file is under /etc/modprobe.d/. However, I do believe I ordered a replacement cable off Amazon. The reason I am posting on this commit is because I am not getting the same device ID that you, @fatyogi https://github.com/fatyogi were listing, but what @bkuschak https://github.com/bkuschak was from QinHeng Electronics. As such I thought this might be the best method to inquire on any additional steps that the user might have needed to complete setup. I am kind of hitting my head against the wall at this point. Not sure if there is another driver to install, or I am just totally botching this. Note: I do not see a /dev/ttyACM0, but do see a ttyAMA0 — Reply to this email directly, view it on GitHub <#7 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4YYO2Z273X5LFP3JNLY2LZL4ZHNAVCNFSM6AAAAABKILACBKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMRUGI3TGNRWG4 . You are receiving this because you were mentioned.Message ID: @.> — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.>

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

Git-Me-Some-Hub commented 4 months ago

@bkuschak - I did go ahead and take your advice and block the kernel loading the driver. I can confirm the lack of the dev/ttyAMA0 folder. I went ahead and found a CH343 driver on github which does load and creates /dev/ttyCH343USB0. Since the grafana page is still not working I will have to find how to test the Serial interface, and then check the Grafana information next. I also bought a cable off Alit Express in the hopes it is the one listed by @fatyogi. That will be my plan b if I cannot get this other one to work.

Thanks to both of you or the help, but I think I need to go back and confirm if something else is messed up.

fatyogi commented 4 months ago

You don’t need Grafana to test your connection to the device. Just run the logger (logtracer.py) and see the output.

But yes the Epever native (Exar) adapter should work out if the box.

On Wed, 17 Jul 2024 at 10:15, Git-Me-Some-Hub @.***> wrote:

@bkuschak https://github.com/bkuschak - I did go ahead and take your advice and block the kernel loading the driver. I can confirm the lack of the dev/ttyAMA0 folder. I went ahead and found a CH343 driver on github which does load and creates /dev/ttyCH343USB0. Since the grafana page is still not working I will have to find how to test the Serial interface, and then check the Grafana information next. I also bought a cable off Alit Express in the hopes it is the one listed by @fatyogi https://github.com/fatyogi. That will be my plan b if I cannot get this other one to work.

Thanks to both of you or the help, but I think I need to go back and confirm if something else is messed up.

— Reply to this email directly, view it on GitHub https://github.com/fatyogi/epever-upower-tracer/pull/7#issuecomment-2231911490, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE4YYO7Z3JWG5ODASNB4KGLZMWLQ7AVCNFSM6AAAAABKILACBKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZRHEYTCNBZGA . You are receiving this because you were mentioned.Message ID: @.***>

Git-Me-Some-Hub commented 4 months ago

Thanks a lot @fatyogi you are completely right, that is 100% the smartest way to test that... I was not totally thinking about what that would result in. Thank @bkuschak your help really got me passed my driver thing and back to making sure the Grafana and python3 was all operating correctly.

I can report I am all good to go. I noticed some issues with what the controller is reporting on the screen, and what it is reporting for watts for PV/DC, but for now I am using the amps * static voltages (PC/DC) right now. a Win's and win. I will be going back through this and writing up some better notes for my own forked code. image

Thanks again.