OVMS3-idf/examples/peripherals
Wangjialin ed1e32f583 bugfix(i2c): add I2C hardware reset if the hw FSM get stuck
Reported from different sources from github or bbs:

https://github.com/espressif/esp-idf/issues/680

https://github.com/espressif/esp-idf/issues/922

We tested reading several sensor or other I2C slave devices, if the power and SDA/SCL wires are in proper condition, everything works find with reading the slave.
If we remove the power supply for the slave during I2C is reading, or directly connect SDA or SCL to ground, this would  cause the I2C FSM get stuck in wrong state, all we can do is the reset the I2C hardware in this case.
After this commit, no matter whether the power supply of I2C slave is removed or SDA / SCL are shorted to ground, the driver can recover from wrong state.

We are not sure whether this the save issue with the reported one yet, but to make the driver more robust.

Further information:

1. For I2C master mode, we have tested different situations, e.g., to short the SDA/SCL directly to GND/VCC, to short the SDA to SCL, to un-plug the slave device, to power off the slave device. Under all of those situations, this version of driver can recover and keep working.
2. Some slave device will die by accident and keep the SDA in low level, in this case, master should send several clock to make the slave release the bus.
3. Slave mode of ESP32 might also get in wrong state that held the SDA low, in this case, master device could send a stop signal to make esp32 slave release the bus.

Modifications:

1. Disable I2C_MASTER_TRAN_COMP interrupt to void extra interrupt.
2. Disable un-used timeout interrupt for slave.
3. Add bus reset if error detected for master mode.
4. Add bus clear if SDA level is low when error detected.
5. Modify the argument type of i2c_set_pin.
6. add API to set timeout value
7. add parameter check for timing APIs
2017-10-21 02:10:59 +08:00
..
adc feature(I2S-ADC): add ADC mode for I2S. 2017-09-14 13:24:08 +08:00
gpio examples: Standardise naming of files, symbols, etc. in examples 2017-03-27 17:42:05 +11:00
i2c bugfix(i2c): add I2C hardware reset if the hw FSM get stuck 2017-10-21 02:10:59 +08:00
i2s i2s: add support apll clock 2017-10-06 15:36:24 +07:00
i2s_adc_dac feature(I2S-ADC): add ADC mode for I2S. 2017-09-14 13:24:08 +08:00
ledc Updated example and descritpion of LED PWM Controller API 2017-10-06 08:34:27 +02:00
mcpwm build: Fix the warnings that break the tests 2017-07-07 11:03:25 +08:00
pcnt Extended description of the Pulse Counter API and removed redundant comments from the example 2017-09-26 22:44:46 +02:00
rmt_nec_tx_rx bugfix(driver): fix RMT issues from github 2017-08-15 17:23:51 +08:00
sigmadelta Updated sigma delta API documenation and example 2017-09-25 21:31:09 +02:00
spi_master example(spi_master): add menuconfig to enable the auto detect of LCD type. 2017-09-06 11:41:07 +08:00
spi_slave SPI: Small fixes according to MR comments 2017-04-27 11:49:04 +08:00
timer_group bugfix(timer group): remove floating-point in timer isr in example. 2017-08-30 23:30:53 +08:00
touch_pad_interrupt Mass replacement of http with https urls, fixed broken urls 2017-09-06 08:16:01 +02:00
touch_pad_read Mass replacement of http with https urls, fixed broken urls 2017-09-06 08:16:01 +02:00
uart_echo Updated UART API documentation and examples. Included a fix of #1091 from GitHub 2017-10-10 05:54:36 +02:00
uart_events Updated UART API documentation and examples. Included a fix of #1091 from GitHub 2017-10-10 05:54:36 +02:00
README.md Added README.md to example category folders 2017-01-18 21:03:15 +01:00

Peripherals Examples

This section provides examples how to configure and use ESP32s internal peripherals like GPIO, UART, I2C, SPI, timers, counters, ADC / DAC, PWM, etc.

See the README.md file in the upper level examples directory for more information about examples.