Messages in this thread | | | From | Krzysztof Hałasa <> | Subject | Re: Sony IMX290/462 image sensors I2C xfer peculiarity | Date | Tue, 10 Oct 2023 11:46:12 +0200 |
| |
Hi,
I'm back to IMX290 and IMX462 sensors running on i.MX8MP (and not on some nonexistent sort of i.MX6 as I previously wrote). The timeout thing happens at circa 2^18 + 8 or + 9 master clocks after the regular START (not repeated START). With MCLK = 37.125 MHz this amounts to ca. 7 ms.
Using imx290.c and the i2c-imx.c I2C driver (NXP's version 5.15, but it doesn't seem to differ significantly from mainstream):
wait_queue_head_t queue;
i2c_imx_trx_complete() wait_event_timeout(queue, ..., HZ / 10);
i2c_imx_master_isr() wake_up(&queue);
Sensor register write example, I've added a couple of obvious printk() calls in the interrupt handler.
First adding some load to each CPU core: for n in 1 2 3 4; do while :; do :; done & done
Then the actual sensor register write: Sending I2C DEVSEL byte: [86.968267] <i2c_imx_write> write slave address: addr=0x34
Completed: [86.968306] <i2c_imx_isr> 0xA2 0xF8 <<<<<< ACK [86.968311] <i2c_imx_master_isr> 0xA2 [86.980361] <i2c_imx_trx_complete> TRX complete
It took 12 ms to wake up, way too long for IMX462 to remain on the I2C bus, so the following byte TX fails.
The question is: what can be done about it? - should I make the camera control thread real time? - or maybe the I2C driver should be modified? - or maybe imx290 register accesses should be somehow atomic? -- Krzysztof "Chris" Hałasa
Sieć Badawcza Łukasiewicz Przemysłowy Instytut Automatyki i Pomiarów PIAP Al. Jerozolimskie 202, 02-486 Warszawa
| |