Post Go back to editing

PEC Error

Category: Hardware
Product Number: ADBMS6822

Hello,

I am developing a custom battery management system for a Formula SAE EV team. My system had basic functionality, up until recently. Now, when I attempt to read isoSPI messages from either my custom ADBMS6830 board mounted to a live module, or ADBMS6830 EVAL board connected to battery stack simulator, I see gibberish for cell voltage readings and a PEC Error of 1, when i use the print voltage function. My code is attached. My current setup is a DC2472A battery stack simulator connected to ADBMS6830 EVAL Board connected via twisted pair to ADBMS6822 EVAL Board which is mounted to Nucleo G474RE. I have also attached a video showing the jumper positions on the ADBMS6822 and my terminal output.

#include "adbms_main.h"
#include "adBms_Application.h"
#include "main.h"
#include <cstdint>

// Set pin modes

DigitalIn driving(PIN_DRIVING);
DigitalIn charging(PIN_CHARGING);
DigitalIn shutdown_tap(PIN_SHUTDOWN);
DigitalOut fault(PIN_FAULT);


DigitalOut master(MASTER_ENABLE);
DigitalOut chip_select(PIN_SPI_CS); // SPI chip select
DigitalOut mosi(PIN_SPI_MOSI);      // SPI MOSI
DigitalIn miso(PIN_SPI_MISO);       // SPI MISO
DigitalOut sclk(PIN_SPI_SCLK);      // SPI CLK

// Set SPI pins (MOSI, MISO, SCLK)
SPI spi(PIN_SPI_MOSI, PIN_SPI_MISO, PIN_SPI_SCLK);

// Configure CAN
CAN can(PB_8, PB_9);

//Configure Serial Communication for Debug 
//Serial pc(USBTX, USBRX);                    

Timer timer;
state_t FSM_state = INIT;
// assert_fault_high();
float cell_voltages[NUM_MODULES][NUM_CELLS];
cell_asic IC[NUM_MODULES];

/*-------------------------------------------------------------------------------------------------
 Main Loop
-------------------------------------------------------------------------------------------------*/
int main() {

    can.frequency(CAN_BAUD_RATE_CHARGE);
    spi_init();
    adBms6830_init_config(TOTAL_IC, &IC[0]);

    adBms6830_write_config(TOTAL_IC, &IC[0]); 
    adBms6830_start_adc_cell_voltage_measurment(TOTAL_IC);
    adBms6830_start_adc_s_voltage_measurment(TOTAL_IC);
    adBms6830_start_aux_voltage_measurment(TOTAL_IC, &IC[0]);

    while(1)
    {
        measurement_loop();
        voltage_can_message(&IC[0]);
    }