vedirect_protocol:faq
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
vedirect_protocol:faq [2017-05-17 19:34] – [Framehandler reference implementation] mvader | vedirect_protocol:faq [2023-03-31 12:04] (current) – mvader | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== VE.Direct Protocol FAQ ====== | ====== VE.Direct Protocol FAQ ====== | ||
+ | ===== 1. Introduction ===== | ||
More information on the VE.Direct protocol is available here: | More information on the VE.Direct protocol is available here: | ||
* [[https:// | * [[https:// | ||
Line 6: | Line 7: | ||
* [[open_source: | * [[open_source: | ||
- | ===== Framehandler | + | Note that, besides a FAQ, this page also contains a framehandler |
- | This the main data receival routine | + | From a hardware point of view, our VE.Direct ports have four pins: positive, TX, RX and GND. The TX and RX go (almost) directly into the UART of the microcontroller of the product. |
+ | To connect directly to such port, we advise to use either our VE.Direct to USB interface, or our VE.Direct to RS232 interface. Both include galvanic isolation circuitry. Having such isolation is important, as in the product itself (ie. in the solar charger, bmv battery monitor, inverter and so forth) there is very little protection. | ||
+ | |||
+ | More information, | ||
+ | |||
+ | |||
+ | ===== 2. FAQ ===== | ||
+ | ==== Q1: Can I use RS232 instead of USB? ==== | ||
+ | Yes, use the //VE.Direct to RS232 interface//, | ||
+ | |||
+ | ==== Q2: When using the VE.Direct to RS232 interface, what pins do I need? ==== | ||
+ | For the communication use the GND, RX and TX pins: pin 5, 2 and 3 on the DB9 connector. | ||
+ | |||
+ | Also the DTR signal (pin 4 on the DB9 connector) and/or the RTS signal (pin 7 on the DB9 connector) must be driven high to power the isolated side of the the interface. How to program the DTR and RTS differs between used operating systems and hardware. Please note that most RS232 drivers are inverting so the logic level of the DTR must be programmed to zero in most cases. When one of those pins is not driven high, you will not be able to receive data! | ||
+ | |||
+ | Background: the " | ||
+ | |||
+ | When using an external power supply to power DTR or RTS, the minimum voltage is 5V, and maximum is 12V. Note that it is normally not necessary to use an external power supply for this: normal serial ports will either automatically drive DTR or RTS high. And if not that, than you can control those pins to be high from within the software. | ||
+ | |||
+ | ==== Q3: How do I calculate the HEX checksum? ==== | ||
+ | I have been able to get the data I need from the sensor (BMV-700H), as show in your examples (im quoting your last email below): | ||
+ | Consider the following example: | ||
< | < | ||
+ | Get Battery Capacity | ||
+ | : | ||
+ | : | ||
+ | </ | ||
+ | |||
+ | So, this works fine when the code of the operation is less than 55 (for instance, 0x10 and 0x00 = 0x1000), and I get the same checksums as you do. However, to ask for the SOC of the batteries, Im not being able to understand how to construct the request, since the code is 0x0FFF, which is greater than 0x55. | ||
+ | Can you provide me with an example of a request, for the SOC of the batteries? I would be much appreciated. | ||
+ | |||
+ | **Anwser:** | ||
+ | VE.Direct/ | ||
+ | The checksum needs to be a byte, therefore you need to wrap it while calculating the checksum. | ||
+ | |||
+ | So in code you can loop through the message as in the following pseudo code: | ||
+ | < | ||
+ | byte checksum = 0x55; | ||
+ | byte message[] = { 0x7, 0xff, 0x0f, 0x00 }; | ||
+ | for (int i =0; i < sizeof(message); | ||
+ | | ||
+ | </ | ||
+ | |||
+ | Example using a Get Command | ||
+ | < | ||
+ | Get command: | ||
+ | : | ||
+ | |||
+ | Get Soc, register 0x0FFF | ||
+ | : | ||
+ | </ | ||
+ | ==== Q4: Is the VE.Direct interface 3.3 or 5V ? ==== | ||
+ | It depends on the product: some are 5v, others 3v3. | ||
+ | |||
+ | The circuits in our panels and USB interfaces work on both voltages. And they automatically adapt their TX voltage to the voltage level coming from the VE.Direct product (bmv/ | ||
+ | |||
+ | List of the products: | ||
+ | |||
+ | * BMV-700: 3v3 | ||
+ | * MPPT all models: 5v | ||
+ | * Newer MPPTs (as now under development) will be 5V. | ||
+ | * MPPT RS, Multi RS, any other RS: 3v3 | ||
+ | * VE.Direct Inverters 250…500VA - 3V3 | ||
+ | * VE.Direct Inverters 800VA & 1200VA 3V3 | ||
+ | * Smart Inverters 1600VA...5000VA - 3V3 | ||
+ | |||
+ | ==== Q5: How much current can I draw from the power pin in the VE.Direct port? ==== | ||
+ | Max 10mA average, with max 20mA/5ms bursts. | ||
+ | |||
+ | ==== Q6: What is the end of line character when sending a HEX message? ==== | ||
+ | |||
+ | This question concerns the situation of your software sending a HEX message to a Victron device, such as a BMV. | ||
+ | |||
+ | As also documented in the HEX protocol documents, the end of line character is '' | ||
+ | |||
+ | ==== Q7: How about frequency of transmitting HEX messages ==== | ||
+ | |||
+ | How often you send a HEX message doesn' | ||
+ | |||
+ | ==== Q8: How do I calculate the TEXT checksum? ==== | ||
+ | |||
+ | I need to get data from a BMV, but how do I check the data integrity? The [[https:// | ||
+ | |||
+ | **Answer: | ||
+ | Consider the following output: | ||
+ | < | ||
+ | PID 0x203 | ||
+ | V 26201 | ||
+ | I 0 | ||
+ | P 0 | ||
+ | CE 0 | ||
+ | SOC 1000 | ||
+ | TTG -1 | ||
+ | Alarm OFF | ||
+ | Relay OFF | ||
+ | AR 0 | ||
+ | BMV 700 | ||
+ | FW 0307 | ||
+ | Checksum � | ||
+ | </ | ||
+ | And as a raw data dump: | ||
+ | < | ||
+ | 00000000 | ||
+ | 00000010 | ||
+ | 00000020 | ||
+ | 00000030 | ||
+ | 00000040 | ||
+ | 00000050 | ||
+ | 00000060 | ||
+ | </ | ||
+ | The checksum needs to be calculated from the start (0d) till the end of the frame, including the checksum value from the frame (d8). | ||
+ | |||
+ | In code you can loop through the message as in the following pseudo code: | ||
+ | <code c> | ||
+ | int checksum = 0; | ||
+ | char message[] = { ... }; | ||
+ | for (int i = 0; i < message.length; | ||
+ | | ||
+ | } | ||
+ | |||
+ | if (checksum == 0) { | ||
+ | /* Checksum is valid => process message */ | ||
+ | | ||
+ | } else { | ||
+ | /* Invalid checksum => reject message */ | ||
+ | } | ||
+ | </ | ||
+ | ===== 2. Framehandler reference implementation ===== | ||
+ | |||
+ | This the main data receival routine of our consumer stack that both handles TEXT and HEX messages. | ||
+ | |||
+ | <code cpp> | ||
#include " | #include " | ||
Line 119: | Line 250: | ||
} | } | ||
</ | </ | ||
- | ===== FAQ ===== | ||
- | === Can I use RS232 instead of USB? === | ||
- | Yes, use the //VE.Direct to RS232 interface//, | ||
- | === When using the VE.Direct to RS232 interface, what pins do I need? === | ||
- | For the communication use the GND, RX and TX pins: pin 5, 2 and 3 on the DB9 connector. | ||
- | |||
- | Also the DTR signal (pin 4 on the DB9 connector) and/or the RTS signal (pin 7 on the DB9 connector) must be driven high to power the isolated side of the the interface. How to program the DTR and RTS differs between used operating systems and hardware. Please note that most RS232 drivers are inverting so the logic level of the DTR must be programmed to zero in most cases. When one of those pins is not driven high, you will not be able to receive data! | ||
- | |||
- | Background: the " | ||
- | |||
- | When using an external power supply to power DTR or RTS, the minimum voltage is 5V, and maximum is 12V. Note that it is normally not necessary to use an external power supply for this: normal serial ports will either automatically drive DTR or RTS high. And if not that, than you can control those pins to be high from within the software. | ||
- | |||
- | === How do I calculate the HEX checksum? === | ||
- | I have been able to get the data I need from the sensor (BMV-700H), as show in your examples (im quoting your last email below): | ||
- | Consider the following example: | ||
- | < | ||
- | Get Battery Capacity | ||
- | : | ||
- | : | ||
- | </ | ||
- | |||
- | So, this works fine when the code of the operation is less than 55 (for instance, 0x10 and 0x00 = 0x1000), and I get the same checksums as you do. However, to ask for the SOC of the batteries, Im not being able to understand how to construct the request, since the code is 0x0FFF, which is greater than 0x55. | ||
- | Can you provide me with an example of a request, for the SOC of the batteries? I would be much appreciated. | ||
- | |||
- | **Anwser:** | ||
- | VE.Direct/ | ||
- | The checksum needs to be a byte, therefore you need to wrap it while calculating the checksum. | ||
- | |||
- | So in code you can loop through the message as in the following pseudo code: | ||
- | byte checksum = 0x55; | ||
- | byte message[] = { 0x7, 0xff, 0x0f, 0x00 }; | ||
- | for (int i =0; i < sizeof(message); | ||
- | checksum -= message[i]; | ||
- | |||
- | Get command: | ||
- | : | ||
- | |||
- | Get Soc, register 0x0FFF | ||
- | : | ||
- | |||
- | === Is the VE.Direct interface 3.3 or 5V ? === | ||
- | It depends on the product: some are 5v, others 3.3. | ||
- | |||
- | The circuits in our panels and USB interfaces work on both voltages. And they automatically adapt their TX voltage to the voltage level coming from the VE.Direct product (bmv/ | ||
- | |||
- | List of the products: | ||
- | |||
- | * BMV-700: 3v3 | ||
- | * MPPT all models (2016): 5v | ||
- | * Newer MPPTs might become 3v3 as well. | ||
- | |||
- | === How much current can I draw from the power pin in the VE.Direct port? === | ||
- | Max 10mA average, with max 20mA/5ms bursts. | ||
===== DISQUS ===== | ===== DISQUS ===== | ||
~~DISQUS~~ | ~~DISQUS~~ | ||
+ |
vedirect_protocol/faq.1495042448.txt.gz · Last modified: 2017-05-17 19:34 by mvader