Skip to content

Example code to communicate with Huawei R4850G2 Power Supply via CAN

Notifications You must be signed in to change notification settings

ChrisR000/Huawei_R4850G2_CAN

 
 

Repository files navigation

Huawei R4850G2 Rectifier / 53.5VDC 3000W Power Supply.

This is example Linux ANSI-C code to communicate with the Huawei R4850 Rectifier / Power Supply via CAN. For details on the PSU and wiring, visit:

This code can be executed on the following targets:

By default the Huawei rectifier communicates at 125kbps with extended 29-bit addressing. Use the following to set up your link:

$ sudo /sbin/ip link set can0 up type can bitrate 125000

To view the current statistics, run: (Where can0 is your can device)

$ ./r4850 can0

Huawei R4850G2 53.5VDC 3000W Rectifier
Configuration Utility
Input Voltage 237.88V @ 50.03Hz
Input Current 0.41A
Input Power 98.18W

Output Voltage 47.98V
Output Current 1.97A of 37.70A Max
Output Power 89.36W

Input Temperature 27.0 DegC
Output Temperature 27.0 DegC
Efficiency 0.91%

To change the preset voltage and current, use the -v & -c switches as per below.

Huawei R4850G2 53.5VDC 3000W Rectifier
Configuration Utility
Usage: r4850 [options] <CAN interface>
Options:
        -v <voltage>    (Set Power Supply Voltage)
        -c <current>    (Set Maximum Current)

This changes the off-line (non-volatile) settings. Please see https://www.beyondlogic.org/review-huawei-r4850g2-power-supply-53-5vdc-3kw/#modes_of_operation

Debugging

The rectifier will send out unsolcitied messages and this is a good way to ensure your hardware is working correctly. Run candump can0 (from CAN-utils) and verify you see frames similar to below (This dump is from power-up) :

$ candump can0
  can0  1000107E   [8]  30 01 6C 68 84 64 2D A4
  can0  1000107E   [8]  30 01 6C 68 84 64 2D A4
  can0  1000107E   [8]  30 01 6C 68 84 64 2D A4
  can0  1001107E   [8]  30 02 6C 68 84 64 2D A4
  can0  1001107E   [8]  30 02 6C 68 84 64 2D A4
  can0  1001107E   [8]  30 02 6C 68 84 64 2D A4
  can0  1001107E   [8]  30 02 6C 68 84 64 2D A4
  can0  1001107E   [8]  30 02 6C 68 84 64 2D A4
  can0  1001107E   [8]  30 02 6C 68 84 64 2D A4
  can0  1001107E   [8]  30 02 6C 68 84 64 2D A4
  can0  1001107E   [8]  30 02 6C 68 84 64 2D A4
  can0  1001117E   [8]  00 01 00 01 00 00 00 00
  can0  1001117E   [8]  00 01 00 01 00 00 00 00
  can0  1001117E   [8]  00 01 00 01 00 00 00 00
  can0  1001117E   [8]  00 01 00 01 00 00 00 00
  can0  1001117E   [8]  00 01 00 01 00 00 00 00
  can0  1001117E   [8]  00 01 00 01 00 00 00 00
  can0  1001117E   [8]  00 01 00 01 00 00 00 00
  can0  1001117E   [8]  00 01 00 01 00 00 00 00
  can0  108081FE   [8]  01 13 00 01 00 00 00 00
  can0  100011FE   [8]  00 02 00 00 00 00 00 00
  can0  1001117E   [8]  00 01 00 01 00 00 00 00
  can0  108111FE   [8]  00 03 00 00 00 00 00 00
  can0  1001117E   [8]  00 01 00 01 00 00 00 00
  can0  108111FE   [8]  00 03 00 00 00 00 00 00
  can0  1001117E   [8]  00 01 00 01 00 00 00 00
  can0  108111FE   [8]  00 03 00 00 00 00 00 00
  can0  1001117E   [8]  00 01 00 01 00 00 00 00
  can0  108111FE   [8]  00 03 00 00 00 00 00 00
  can0  1001117E   [8]  00 01 00 01 00 00 00 00
  can0  108111FE   [8]  00 03 00 00 00 00 00 00
  can0  1001117E   [8]  00 01 00 01 00 00 00 00
  can0  108111FE   [8]  00 03 00 00 00 00 00 00

Protocol

The data above can be requested by sending:

 can0  108040FE   [8]  00 00 00 00 00 00 00 00

The rectifier will then return the following packets:

  can0  1081407F   [8]  01 0E 00 00 00 00 00 0A  
  can0  1081407F   [8]  01 70 00 00 00 01 A6 84   (Input Power)
  can0  1081407F   [8]  01 71 00 00 00 00 C8 0A   (Input Freq)
  can0  1081407F   [8]  01 72 00 00 00 00 01 C2   (Input Current)
  can0  1081407F   [8]  01 73 00 00 00 01 80 8E   (Output Power)
  can0  1081407F   [8]  01 74 00 00 00 00 03 A4   (Efficiency)
  can0  1081407F   [8]  01 75 00 00 00 00 D5 C8   (Output Voltage)
  can0  1081407F   [8]  01 76 00 00 00 00 04 6A   (Maximum Output Current)
  can0  1081407F   [8]  01 78 00 00 00 03 C0 80   (Input Voltage)
  can0  1081407F   [8]  01 7F 00 00 00 00 64 00   (Output Stage Temperature)
  can0  1081407F   [8]  01 80 00 00 00 00 70 00   (Input Stage Temperature)
  can0  1081407F   [8]  01 81 00 00 00 00 07 B2   
  can0  1081407F   [8]  01 82 00 00 00 00 07 32   (Output Current)
  can0  1081407E   [8]  01 83 00 10 00 00 00 00

Acknowledgements

This work is based on esp32 code developed by BotoX

https://github.com/BotoX/huawei-r48xx-esp32

https://github.com/BotoX/r4830g2-tiva

About

Example code to communicate with Huawei R4850G2 Power Supply via CAN

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C 98.9%
  • Makefile 1.1%