CH101 Failing to Initialise at chdrv_wait_for_lock

By adamrosendorff… , 13 July 2022

Hi,

I'm trying to interface with a CH101 sensor. I am able to detect the sensor, and I think the firmware upload is working as expected, but the setup seems to fail at the "chdrv_wait_for_lock" function, with the I2C lines appearing to be pulled low and remain low. Has anyone else had an issue in this stage of the initialisation? The INT line is being pulsed high by the sensor after the bulk of the firmware has been written.

I am using an STM32 nucleo board.

adamrosendorff…

3 years 8 months ago

When setting the CHDRV_DEBUG flag this is the output I get from the program so everything seems to be working up until that point

Test I2C read: 020A
PROG_STAT: 0x05
chdrv_init_ram
Loading RAM init data...
Wrote 13 bytes in 1 ms.
chdrv_write_firmware
Programming Chirp sensor...
Wrote 2048 bytes in 62 ms.
Changing I2C address to 10
Sensor count: 1, 80 ms.
Chirp sensor initialized on I2C addr 0:10.
Sensor hu initialization timed out or missing

phpbb Post ID
39514

simoneiammarin…

3 years 8 months ago

Hi Adamrosy,

Make sure to implement the "chbsp_timestamp_ms()" function because is required by "chdrv_wait_for_lock()" also if in the comment is flagged as OPTIONAL.

phpbb Post ID
39516

vitorpaixaorum…

3 years 4 months ago

Hello!

Have you solved the problem?

Could you share the solution?

Thank you.

phpbb Post ID
39593

minggaotdkcom

2 years 7 months ago

Yes, chbsp_timestamp_ms and chbsp_delay_ms are both needed. You also can try to extend the MACRO: CHDRV_FREQLOCK_TIMEOUT_MS to 200 or 300 (in ch_driver.h)

phpbb Post ID
45095
phpbb Topic ID
39513