Skip to content

Commit

Permalink
Merge pull request #225 from ligenxxxx/fix-calib-dcoc
Browse files Browse the repository at this point in the history
fix calib dcoc
  • Loading branch information
ligenxxxx authored Nov 8, 2024
2 parents 544f87e + 3837d98 commit 9b62b3d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
6 changes: 4 additions & 2 deletions src/hardware.c
Original file line number Diff line number Diff line change
Expand Up @@ -1626,6 +1626,10 @@ void check_eeprom() {
uint8_t ff_cnt[3];
uint8_t i, j, k;

#ifdef _RF_CALIB
return;
#endif

// read all 3 table_power partitions
for (i = 0; i < 3; i++) {
ff_cnt[i] = 0;
Expand Down Expand Up @@ -1697,8 +1701,6 @@ void check_eeprom() {
}
}

if (ff_cnt[0] == 3)
return;
// Init partition 1/2 by copy paratition 0 if is needed (one time)
if ((ff_cnt[1] + ff_cnt[2]) > 5) {
for (j = 0; j < 5; j++) {
Expand Down
32 changes: 16 additions & 16 deletions src/rom.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void CalibProc() {

DM6300_SetPower(RF_POWER, RF_FREQ, pwr_offset);

I2C_Write8_Wait(10, ADDR_EEPROM, RF_FREQ * (POWER_MAX + 1) + RF_POWER, table_power[RF_FREQ][RF_POWER]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_TAB1 + RF_FREQ * (POWER_MAX + 1) + RF_POWER, table_power[RF_FREQ][RF_POWER]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_TAB2 + RF_FREQ * (POWER_MAX + 1) + RF_POWER, table_power[RF_FREQ][RF_POWER]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_TAB3 + RF_FREQ * (POWER_MAX + 1) + RF_POWER, table_power[RF_FREQ][RF_POWER]);
break;
Expand Down Expand Up @@ -117,21 +117,21 @@ void CalibProc() {
SPI_Write(0x3, 0x388, dcoc);

// write to eeprom
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC_EN, 0x00);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC_IH, rxbuf[2]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC_IL, rxbuf[3]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC_QH, rxbuf[4]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC_QL, rxbuf[5]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC2 + EEP_ADDR_DCOC_EN, 0x00);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC2 + EEP_ADDR_DCOC_IH, rxbuf[2]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC2 + EEP_ADDR_DCOC_IL, rxbuf[3]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC2 + EEP_ADDR_DCOC_QH, rxbuf[4]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC2 + EEP_ADDR_DCOC_QL, rxbuf[5]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC3 + EEP_ADDR_DCOC_EN, 0x00);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC3 + EEP_ADDR_DCOC_IH, rxbuf[2]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC3 + EEP_ADDR_DCOC_IL, rxbuf[3]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC3 + EEP_ADDR_DCOC_QH, rxbuf[4]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC3 + EEP_ADDR_DCOC_QL, rxbuf[5]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC1 + 0, 0x00);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC1 + 1, rxbuf[2]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC1 + 2, rxbuf[3]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC1 + 3, rxbuf[4]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC1 + 4, rxbuf[5]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC2 + 0, 0x00);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC2 + 1, rxbuf[2]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC2 + 2, rxbuf[3]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC2 + 3, rxbuf[4]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC2 + 4, rxbuf[5]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC3 + 0, 0x00);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC3 + 1, rxbuf[2]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC3 + 2, rxbuf[3]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC3 + 3, rxbuf[4]);
I2C_Write8_Wait(10, ADDR_EEPROM, EEP_ADDR_DCOC3 + 4, rxbuf[5]);
break;
}
break;
Expand Down

0 comments on commit 9b62b3d

Please sign in to comment.