config changes that didn´t do shit

This commit is contained in:
2024-10-17 16:12:29 +02:00
parent 05eb7db05f
commit 7367d5165b
39 changed files with 6434 additions and 6335 deletions

View File

@ -35,6 +35,7 @@ uint8 amsReset() {
CHECK_RETURN(writeCMD(CLOVUV, buffer, 6)); //OVUV flags
CHECK_RETURN(writeCMD(ADCV | ADCV_CONT | ADCV_RD, NULL, 0)); //start continuous cell voltage measurement with redundancy
CHECK_RETURN(writeCMD(ADAX, NULL, 0)); //start aux measurement
CHECK_RETURN(writeCMD(ADAX2, NULL, 0)); //start aux measurement
return 0;
}
@ -47,6 +48,13 @@ uint8 initAMS(SPI_HandleTypeDef* hspi, uint8 numofcells, uint8 numofaux) {
return amsReset();
}
uint8 amsConfig() {
uint8 buf[6] = {};
CHECK_RETURN(readCMD(RDCFGA, buf, CFG_GROUP_A_SIZE));
buf[3] = buf[3] | 0b00011000;
CHECK_RETURN(writeCMD(WRCFGA, buf, CFG_GROUP_A_SIZE))
}
uint8 amsWakeUp() {
uint8 buf[6];
return readCMD(RDCFGA, buf, 6);
@ -125,6 +133,7 @@ uint8 amsAuxAndStatusMeasurement(Cell_Module* module) {
module->refVoltage = mV_from_ADBMS6830(rxbuffer[4] | (rxbuffer[5] << 8));
CHECK_RETURN(writeCMD(ADAX, NULL, 0)); //start aux measurement for next cycle
CHECK_RETURN(writeCMD(ADAX2, NULL, 0)); //start aux measurement
return 0;
}

View File

@ -295,10 +295,10 @@ uint8 writeCMD_I2C(uint16 command, uint16_t waitTime, uint8* args, uint8 arglen)
ret = mcuSPITransmit(buffer, 4);
// HAL_Delay(1);
for (int i=0; i<64000 * waitTime; i++){
__ASM volatile ("NOP");
}
HAL_Delay(1);
// for (int i=0; i<64000 * waitTime; i++){
// __ASM volatile ("NOP");
// }
mcuAdbmsCSHigh();
}

View File

@ -39,6 +39,8 @@ uint8_t AMS_Init(SPI_HandleTypeDef* hspi) {
amsov = DEFAULT_OV;
amsuv = DEFAULT_UV;
amsConfig();
pollingTimes = (struct pollingTimes) {HAL_GetTick(), HAL_GetTick()};
return ret;
@ -73,7 +75,7 @@ uint8_t AMS_Idle_Loop() {
}
if (eepromBuf != 7){
while(1){}
// while(1){}
}
return 0;