ICU10201 on PIC

By pgdelestfr , 23 April 2024

Hello,
I've implemented your library on a PIC18 to control an ICU-10201.
The SPI connection works fine, from the beginning I managed to read the "SHASTA CPU ID: 0x2041".
Then I realized the compiler had some limitation computing number, creating some overflow (on uint16_t) giving back a value modulo the size of uint16_t. That's fixed with proper cast into 3 expressions I corrected.

I've tested different paramaters, diffrents settings but still stuck. The pmut frequency after calibration is always arounf 48Khz where it should be around 175Khz right? Also the BIST data all read at zero, and the BIST Read I/Q data log an error (see my log below).
What did I miss? How can move forward? Can you please guide and help? Thanks

### chbsp_board_init ###
SHASTA CPU ID: 0x2041

### ch_init ###

### ch_group_start ###
PROG_STAT: 0xFFFF
chdrv_init_ram
Loading RAM init data...
Wrote 566 bytes in 3 ms.
chdrv_write_firmware
Programming sensor...
Wrote 6144 bytes in 26 ms.
Sensor shared mem addr = 0x1066
Sensor algo info addr = 0x103a
dev_ptr->max_samples=340
Sensor count: 1, 57 ms.
chdrv_clock_init: cpu_trim=0x1e pmut_trim=0x4028 rtc_source=0 control=0x00 step=0
RTC calibrated, 179 ms
0 : Cal result = 2984
chdrv_group_start: exiting debug mode

ch_common_store_op_freq: dev_ptr->fcount_cycles = 128
ch_common_store_op_freq: dev_ptr->rtc_frequency = 29840 Hz
pmut freq trim before = 0x4028
triggering BIST
pmut freq trim after = 0xc06e

BIST: fcount=0 pmut_clock_fn_code=0x0000 sf=0 rd=[0,0]
PMUT instr 0: cmd_config=0x0000 length=0
PMUT instr 1: cmd_config=0x0000 length=0
PMUT instr 2: cmd_config=0x0000 length=0
PMUT instr 3: cmd_config=0x0000 length=0
PMUT instr 4: cmd_config=0x0000 length=0
measure_pmut_frequency: raw_pmut_count = 12311 pmut_freq = 48303 Hz
chdrv_cpu_freq_calculate: raw_cpu_count = 10251 cpu_freq = 38236230 Hz
chdrv_cpu_freq_adjust: starting cpu_freq=38236230 starting cpu_trim=30
chdrv_cpu_freq_adjust: mult_offset=366678 (min=96606 max=676242)
Error reading BIST IQ data : 1
OK

PROGRAM CHECK OK
Sensor Type Freq RTC Cal B/W CPU Freq Firmware
0 ICU-10201 48303 Hz 2984@100ms 0Hz 38.24MHz gpt_1.6.1

Sensor Id Year Week Site Product Package MEMS Module
0 14604VU 2022 W40 1 002 255 1 255

### ch_io_int_callback_set ###

### ch_set_config ###
num_samples=53
clear_interrupts 0
clear_interrupts: eof_idx=-1 rx_idx=-1
ch_common_meas_set_max_range: ret_val: 0 meas_num: 0 dev_ptr->meas_num_rx_samples: 0
clear_interrupts 0
clear_interrupts: eof_idx=-1 rx_idx=-1
clear_interrupts 0
clear_interrupts: eof_idx=-1 rx_idx=-1

phpbb Topic ID
45601