Commit graph

375 commits

Author SHA1 Message Date
Ivan Grokhotkov c6829fa5b8 sdmmc: improve error handling during SPI mode init
- In SPI mode, the card will respond to the initial SDIO reset (done
using CMD52) with “invalid command” error. Handle this correctly.

- sdmmc_card_init had a hack where GO_IDLE_STATE (CMD0) command was
sent twice. Add explanation why this is done, and don’t expect
correct response from the card on first CMD0.

- improve logs printed at debug level by adding CMD index
2018-04-11 11:11:17 +08:00
Ivan Grokhotkov ee600784c5 sdmmc: add SDIO support
- Add SDIO support at protocol layer (probing, data transfer, interrupts)
- Add SDIO interrupts support in SDMMC host
- Add test (communicate with ESP32 in SDIO download mode)
2018-04-11 11:07:13 +08:00
Ivan Grokhotkov 5f97e6bebb sdmmc: fill as many DMA descriptors as possible 2018-04-11 11:06:50 +08:00
Ivan Grokhotkov 20a8c3318a sdmmc: do expect CMD_DONE interrupt after response timeout
Existing code assumed that response timeout is not followed by CMD_DONE,
which was not true, in fact. Host datasheet states that CMD_DONE is sent
after an RTO.
2018-04-11 11:06:50 +08:00
Ivan Grokhotkov 01cd2fce73 sdmmc: print error status only once 2018-04-11 11:06:50 +08:00
Ivan Grokhotkov 5fc6fb58ea sdmmc: don't whitelist the opcodes when handling response timeout
All the commands which do not have a response must have their flags set
accordingly. Therefore the host will not send RTO interrupt if response
is not expected. It is a bug in the code logic if it happens otherwise.
2018-04-11 11:06:50 +08:00
Ivan Grokhotkov f02cff13cc sdmmc: set highest possible host clock divider
SDMMC host suffers from an issue that it outputs data near the rising
edge of the card clock, which is the edge used by the card to sample
data. If sampling time constraint is not satisfied, card may read data
after the transition.

The phases of output/input data can, in fact, be adjusted. However this
adjustment happens in the clock generation block outside of the host.
So the maximum phase change which can be created this way is equal to
half of the host clock period. So if the host clock is set to the lowest
possible frequency (for the given card frequency), then the phase offset
(and hence the hold time) will be the highest. This change modifies the
logic used to determine clock dividers accordingly.

sdmmc host: set correct dout phase and print correct frequency
2018-04-11 11:06:50 +08:00
Ivan Grokhotkov 84d6793f77 sdmmc: don't set data_expected on SET_BUS_WIDTH command
SET_BUS_WIDTH is not a data transfer command. Extensive search in the
host datasheet and SD card spec did not reveal the origin of this hack
or 'feature'. Further testing showed that removing this does not lead to
regressions.
2018-04-11 11:06:50 +08:00
Ivan Grokhotkov 42de5fb76d sdmmc: send init sequence before CMD0 2018-04-11 11:06:50 +08:00
Ing. Jaroslav Šafka 3d89c8ba74 rmt: Fix LoadProhibited on RX END
Fixes exceptions LoadProhibited, when rmt tries read variable p_rmt on RX END which can be 0.
It happens after esp_reset()  (OTA) and the rmt is not probably stopped by it.
In other words the routine rmt_driver_isr_default was called before second rx channel was registered.

scenario:
register tx channel
register rx channel
reboot
register tx channel
-> exception (because rx channel is accessed)

Merges https://github.com/espressif/esp-idf/pull/1671
2018-04-09 12:29:05 +10:00
Angus Gratton 53234ef2bc Merge branch 'refactor/rtc_split_module' into 'master'
bugfix(rtc): make sure peripherals (DAC, HALL) are turned off before conversion.

See merge request idf/esp-idf!1848
2018-04-04 09:00:58 +08:00
Ivan Grokhotkov 4a2489b99a sdspi: fix compatibility issue in multi block read
SDSPI driver optimized polling of the response tokens by requesting
two extra bytes on top of the block size (512) and CRC (2), and
checking whether these bytes contained the data response token or
not. In case the token was there, further polling would not need to
happen, thereby reducing latency between two consecutive blocks
transferred. However this caused compatibility issues when these two
extra bytes were sent after reading the final block. When
STOP_TRANSMISSION command was sent, these extra two bytes were
treated as part of the command, causing an invalid command error.

This fixes the logic by only requesting extra two bytes if the block
being read is not the final block. In addition to that, more strict
error checking is implemented for command response tokens.
2018-03-30 18:49:42 +08:00
Ivan Grokhotkov 229f67b816 sdspi: handle delayed R1 responses for data read commands 2018-03-30 18:49:42 +08:00
Ivan Grokhotkov bbbdec24d9 sdspi: handle error flags for R3/R7 responses
Previously error flags were only handled for R1 responses. This change
moves error handling into a separate function and calls it for R1/R3/R7.
2018-03-30 18:49:42 +08:00
Jiang Jiang Jian 8b9f237cb9 Merge branch 'feature/i2s_add_expand_function' into 'master'
add a new i2s feature to expand the original i2s width

See merge request idf/esp-idf!1617
2018-03-30 14:51:23 +08:00
Ivan Grokhotkov 1a157279e0 Merge branch 'doc/adc1_channel_config' into 'master'
adc: Add doc details about configure not needed before each read

See merge request idf/esp-idf!2132
2018-03-28 19:11:44 +08:00
Michael (Xiao Xufeng) cef8baf424 bugfix(rtc): make sure peripherals (DAC, HALL) are turned off before conversion.
refactor structure of ``rtc_module.c`` to make it more clearly.

Closes https://github.com/espressif/esp-idf/issues/1517
2018-03-28 17:10:01 +08:00
Angus Gratton 4507b3fde6 adc: Add doc details about configure not needed before each read 2018-03-28 11:52:41 +11:00
Ivan Grokhotkov 2935e958fc Merge branch 'bugfix/adc2_cct' into 'master'
fix(adc2): fix cct and xpd configurations to improve precision of ADCs

See merge request idf/esp-idf!2020
2018-03-27 16:23:43 +08:00
Ivan Grokhotkov 892f3907fa Merge branch 'bugfix/i2c_ack_error_bug' into 'master'
driver(i2c):  Fixed i2c interrupt wdt timeout bug

See merge request idf/esp-idf!2049
2018-03-27 12:29:23 +08:00
Michael (Xiao Xufeng) 7563510758 feat(spi_master): allow output high speed data when dummy bits are not used. 2018-03-26 21:24:32 +08:00
michael 28e832c37e fix(adc2): fix cct and xpd configurations to improve precision of ADCs 2018-03-26 12:02:26 +00:00
kooho 37db055cff driver(i2c): Fixed ack_err interrupt can't exit bug. 2018-03-26 16:31:17 +08:00
Zhang Zhao Xiang f48ecb8613 Add a new i2s feature to expand the original i2s width 2018-03-22 18:52:55 +08:00
Ivan Grokhotkov 7e2028d598 Merge branch 'bugfix/gpio_timer_doc_fixes' into 'master'
Minor fixes of GPIO and timer group driver docs

See merge request idf/esp-idf!2081
2018-03-20 10:49:36 +08:00
Ivan Grokhotkov b9a8912659 Merge branch 'bugfix/spi_master_const_dev_config_t' into 'master'
spi master: use constant dev_config parameter in spi_bus_add_device

See merge request idf/esp-idf!2082
2018-03-19 16:31:19 +08:00
Jonathan Kaufmann a99d4d5a7f Modified spi_bus_add_device so that it takes a constant *dev_config parameter.
Merges https://github.com/espressif/esp-idf/pull/1690
2018-03-19 12:17:45 +08:00
Stefan Tauner 38daa1e716 docs: fix description of timer_get_alarm_value()
Replace c&p text with an actual description.

Merges https://github.com/espressif/esp-idf/pull/1740
2018-03-19 11:56:57 +08:00
Stefan Tauner 86a1d579ff docs: add warning to gpio_get_level()
On most microcontrollers I have worked with one can retrieve the
current state of output GPIO pins. On ESP32 this is not the case
if the pad is not explictly configured to route this information into
the port by configuring it as input or i/o.
Thus add a warning to the API documentation of gpio_get_level().

Merges https://github.com/espressif/esp-idf/pull/1740
2018-03-19 11:56:57 +08:00
Michael (Xiao Xufeng) 15be0829fa test(spi_master): test spi master speed performance by median value.
also increase the boundary of SPI limit by a little.
2018-03-16 16:37:19 +08:00
Ivan Grokhotkov c8ba6cf156 Merge branch 'feature/rtc_gpio_isolate' into 'master'
Add rtc_gpio_isolate function, use it in deep sleep examples

See merge request idf/esp-idf!1936
2018-02-26 06:09:08 +08:00
Angus Gratton 63ddae5087 Merge branch 'bugfix/i2s_driver' into 'master'
i2s: add support fixed_mclk configuration

See merge request idf/esp-idf!1600
2018-02-22 12:03:26 +08:00
Tuan PM 7cda34c626 i2s: add support fixed_mclk configuration 2018-02-22 09:00:23 +07:00
h3ndrik dcc466a673 i2s: fix type mismatch of intr_alloc_flags
Merges https://github.com/espressif/esp-idf/pull/1589
2018-02-16 16:20:12 +11:00
Ivan Grokhotkov 363c096f2b Merge branch 'test/adc2_with_wifi_reopen' into 'master'
test(adc2): re-enable the adc2 test.

See merge request idf/esp-idf!1926
2018-02-11 22:32:18 +08:00
Ivan Grokhotkov f45622ff17 driver/rtc: add rtc_gpio_isolate helper function to disconnect RTC IO 2018-02-11 13:18:51 +08:00
Ivan Grokhotkov e381c6adde Merge branch 'bugfix/fix_i2s_adc_mode' into 'master'
driver(i2s): fix broken i2s adc mode

See merge request idf/esp-idf!1653
2018-02-11 12:58:58 +08:00
Ivan Grokhotkov 62f924544d Merge branch 'test/spi_performance' into 'master'
test(spi_master): add performance display for spi master.

See merge request idf/esp-idf!1923
2018-02-08 22:59:40 +08:00
michael 687d6aa2cd test(adc2): re-enable the adc2 test. 2018-02-08 13:48:25 +08:00
Jeroen Domburg 35de8d703e Merge branch 'bugfix/spi_gpio0' into 'master'
fix(spi): several fixes about maros (flags) and GPIO0.

See merge request idf/esp-idf!1666
2018-02-07 18:50:13 +08:00
Michael (Xiao Xufeng) a151767426 test(spi_master): add performance display for spi master. 2018-02-07 17:50:13 +08:00
Wangjialin 451f69cc2e driver(i2s): fix broken i2s adc mode
1. Move i2s reset code from i2s_stop to i2s_start.
2. add RTC API to set sw mode for ADC
3. add description for adc_power_always_on()
4. add lock for i2s dma and RTC ADC functions.
5. add ADC read task in example

reported from bbs:  https://esp32.com/viewtopic.php?f=13&t=3490&p=17522#p17522
reported from github: https://github.com/espressif/esp-idf/issues/1333
2018-02-07 17:17:20 +08:00
Michael (XIAO Xufeng) e14e1508cb fix(sdmmc_host): fix the issue when slot and host flag are not compatible. 2018-02-07 12:05:05 +08:00
Michael (XIAO Xufeng) 8abbb17401 feat(sdmmc_host): force pull-up DAT3 for SD 4-bit mode so that slave will not fall into SPI mode. 2018-02-07 12:05:05 +08:00
Michael (Xiao Xufeng) 5214a0600c test(adc2): temporary ignore adc2 unit test (with WiFi) to pass the CI.
the issue is introduced in commit 17f01eb718.
2018-02-06 11:59:40 +08:00
Angus Gratton 4297c337f9 esp32: Add IO_MUX_GPIOxx register names to match iomux names used in TRM
The TRM describes IOMUX registers are IO_MUX_x_REG for x in GPIO0-39.

Until now ESP-IDF describes them as PERIPHS_IO_MUX_(pinname)_U

This commit adds additional IOMUX register names which match the ones used in the TRM.
2018-01-30 17:09:37 +08:00
michael be96e1db95 fix(spi): fix typo of LSBFIRST macro.
Closes https://github.com/espressif/esp-idf/issues/1480, Closes https://github.com/espressif/esp-idf/issues/1464
2018-01-29 17:44:37 +08:00
michael 8900200147 fix(spi_master): fix the variable command and address flag issue.
Closes https://github.com/espressif/esp-idf/issues/1549
2018-01-29 17:44:36 +08:00
michael 60469c500a fix(spi): fix pin issue with GPIO0 (other pins than CS). 2018-01-29 17:44:36 +08:00
Wangjialin 870efdb9d4 bugfix(uart): patten detect function
requirement from github(https://github.com/espressif/esp-idf/issues/805): to provide the position in the buffer of the pattern detected.

requirement from AT application: in AT app, when no hardware flow control is enabled, in some situation the rx buffer might be full, and the terminator “+++” might be lost, we can use pattern detect interrupt to avoid missing the terminator. When pattern detect interrupt happens, it will not send a data event at the same time.

1. Add API to get position of detected pattern in rx buffer
2. Modify UART event example
3. Add comments for uart_flush, add alias API uart_flush_input to clear the rx buffer
4. Modify the way rx_buffered_len is calculated
2018-01-22 13:33:51 +08:00