This example code brief :--
1> Tested without the SL of BMS, so no dependency on the BMS Saftey lbrary.
2> Its tested on 2 AFE MC33774 board connected in TPL
3> Change following macro in mc33774_cfg.h file to change the numbers of AFE connected in TPL.
RTD : 3.0.0 P07
BMS SDK : 1.0.2
This example does this task :--
=================== Setup used ============
Attached code is tested with TWO MC33774 AFE connected in TPL mode.
=============== MCU Pins used ===========
TPL1-TX :--
TPL1TXCSB --> PTC6/LPSPI0_PCS1
TPL1TXSCLK --> TPL12TXCLK --> PTE1/LPSPI0_SCK
TPL1TXDATA --> TPL12TXDATA --> PTE2/LPSPI0_SOUT
TPL1-RX :--
TPL1RXCSB --> PTB17/LPSPI1_PCS3
TPL1RXCLK --> PTB14/LPSPI1_SCK
TPL1RXDATA --> PTB15/LPSPI1_SIN
================= EVB Link ==================
================== Measurement types used in example =====
Periodic measurement is done by 33774 , this is cyclic
Other Two : application , sync need send command to start
Application measurement , need send app_capture command twice , and then read the result.
Synchronous measurement take out the Primary adc result(VC)and secondary result(VB) .But the VC and VB result comes from different adc.
Period measurement start when you send API "MSR_StartMeasurement" and then 774 will do period measurement automatically periodically :--
Why we need to measure Vc & Vb both :--
ASIL-D ,yes we can measurement VC channel by primary ADC and measurement VB by secondary ADC from hardware VC and VB are come from same point of battery cell. Now 2 ADC compare with each other, that lead to high safety (ASIL D).
Primary & Secondary Device temperature reading :--
This API is used for it MC33774_CDD_BCC_SWC_Running_Slot4().
============= Cell Balancing ===========
Cell Balancing method used :--
MC33774 balance will switch between odd channel (1,3,5,7,... 17) and even channel (2,4,6,8,..18) by 500ms period , (250ms for odd and then switch to even 250ms and then odd 250ms...)it is because of IC design and cannot change by software.
MC33774 have lots of balance method this example uses "timer method ".
How to check Balancing is enabled :--
Following function MC33774_CDD_BCC_SWC_Running_Slot5() read the :
Balance status & fault registers
BAL_SWITCH_STAT0, BAL_SWITCH_STAT1 represent the balancing MOSFET current status.
Measure the voltage drop across the balancing register is the best approach. You will see the voltage drop appears every 250ms if PWM is 100%.
Please check the schematic of the 33774 EVB, find the balancing resistor on which channel balancing is enabled.
======= How much time to wait to extract the measurements results =======
240 us is the time of one SCAN
Time between each Application measurement sequence.
Min App measure time for 16 sample :--
4.08ms = (16+1) *240
Min 1 SYNC measurement time, for 16 samples =
18 cycle ≈ 18 * (16*240us) ≈ 69 ms
============= Using Debugger ============
Debugger breakpoint will cause the communication timeout at the AFE, which will RESET the AFE. To use the debugger while development you need to disable the communication timeout.
In S32DS MEX file you cannot disable the timeout function ( limit the value of 0~255)
Disable Communication timeout in code :--
================= Results for FIRST AFE ===========================
Application Measurement : Cell voltage result :--
SYNC measurement : VC, VB same for both primary & Secondary measure :--