AmbiqSuiteSDK
AmbiqSuiteSDK copied to clipboard
I2C example `ios_lram_host` in the SDK has a bug
Looking for a good example on how to use the IOM HAL to implement an I2C master, I found ios_lram_host.c. That one has a (minor) bug. Given that Ambiq doesn't seem to have a good issue tracker, I report that bug here instead. Maybe this repo can evolve into a community maintained, better quality SDK?
The example contains the following lines within the function iom_set_up:
// Enable interrupts for NB send to work
am_hal_iom_interrupt_enable(g_IOMHandle, 0xFF);
"NB" most likely refers to "non-blocking".
However, it turns our that am_hal_iom_interrupt_enable refuses the 0xFF, because the FIFO interrupt "shall not be used" (so the function source sais).
It seems that the HAL methods for non-blocking transfers do a lot of interrupt managing anyway, so most likely, it's simply not true that interrupts need to be enabled.
While this issue is inconsequential in the example, it is confusing for anyone trying to write high-quality code which does actually check error codes.
Good catch @burnpanck! Thank you for sharing this information with everyone. Hopefully we will see this improved in future versions of the SDK