Hi
I am using NXP OM13088 develop board.
I try example usbd_rom_hid_generic combined with i2c transfer.
I want to do i2c transfer in endpoint handler
I run this code, and found the device would be stuck in the Chip_I2C_EventHandler. The status is keeping I2C_STATUS_BUSY.
Hi,
Please download the LPCOpen software for OM13088 (LPCXpresso4367 Development Board) from here.
There provides I2C master interrupt/polling demo with below path:
..\lpcopen_3_02_keil_iar_xpresso4337\LPC43xx_18xx\examples_43xx_18xx\periph_i2cm_interrupt
..\lpcopen_3_02_keil_iar_xpresso4337\LPC43xx_18xx\examples_43xx_18xx\periph_i2cm_polling
Please refer above demos about I2C master application.
Wish it helps.
Have a great day,
Mike
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Mike
Thanks for your suggenstion.
I found that we can't do i2c transfer in the usb interrupt handler.
I causes dead lock for waiting i2c interrupt handler.
Thanks.
Sam
Hi Sam,
You can set a I2C transfer flag at usb interrupt service routine.
The I2C transfer flag will trigger I2C transfer, when exit the usb service routine.
Wish it helps.
Have a great day,
Mike
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
Hi Mike
Would you please help provide sample codes for setting I2C trasnfer flag?
Thanks for your help.
Sam
Hi Sam,
What I mentioned I2C transfer flag is just a volatile global variable.
The I2C communication is slow, which shouldn't take place in USB interrupt service routine.
Thank you for the attention.
best regards,
Mike
Hi Mike
That's clear.
I will try i2c transfer in other place.
Thanks.
Sam
By the way, from oscilloscope, I saw the i2c scl from hight to low and keeping low forever.
Thanks.