Commit graph

458 commits

Author SHA1 Message Date
Ivan Grokhotkov a2556229aa Merge branch 'bugfix/uart_fix_get_baudrate_error_bug' into 'master'
driver(uart):   Fix uart_get_baudrate incorrect return value when using ref_tick

See merge request idf/esp-idf!2295
2018-05-08 20:25:13 +08:00
michael 197f594b06 fix(spi): fix the issue when bus flag not set, dual mode cannot be used. 2018-05-08 15:47:26 +08:00
michael 28beafc624 fix(spi): fix the issue that native pins don't work after SPI initialized before 2018-05-08 15:47:25 +08:00
Michael (XIAO Xufeng) 1f085b1a3b feat(gpio): add function allowing switching input source from GPIO back to IOMUX 2018-05-08 15:47:25 +08:00
Angus Gratton b90ad81f22 driver: Add notes to SPI driver docs about thread safety 2018-05-07 09:03:48 +08:00
kooho 0dca2d4c68 driver(uart): Fix uart_get_baudrate incorrect return value when using ref_tick 2018-05-04 09:41:41 +08:00
Liu Zhi Fu ed46976f41 esp32/bt/driver: support static allocation of FreeRTOS queues used by ISR routine
Support static allocation of FreeRTOS queues used by ISR routine in WiFi/BT/esp_timer/driver etc
2018-04-27 15:02:30 +08:00
Ivan Grokhotkov 2699bb49ae sdspi: handle delayed responses for data write commands
Command response tokens can be delayed from the original command by 1
to 8 bytes. In 4a2489b9, handling for delayed tokens was added for
normal (no data) commands, and data read commands. This adds handling
for delayed commands for data write commands.
2018-04-26 10:04:44 +08:00
Ivan Grokhotkov 52f9a5ca16 Merge branch 'bugfix/sdspi_wp_cd_pins' into 'master'
sdmmc, sdspi: fix handling of CD and WP

See merge request idf/esp-idf!2285
2018-04-24 20:53:47 +08:00
Ivan Grokhotkov 85ab4fc83e sdmmc host: add handling of CD and WP pins
Previous version of the code only connected CD and WP to the
peripheral, in fact the hardware does not use the values of these
signals automatically. This adds code to read CD and WP values when
command is executed and return errors if card is not present, or
write command is executed when WP signal is active.
2018-04-24 19:08:44 +08:00
Ivan Grokhotkov 829c6cef39 sdmmc host: when parameter validation fails, exit cleanly
This fixes lock-up which happened when sending a command, if the
previous command has failed.
2018-04-24 19:08:44 +08:00
Ivan Grokhotkov 92a16ac6e6 sdspi: fix CD and WP incorrectly configured as outputs 2018-04-23 14:35:40 +08:00
Ivan Grokhotkov 2a7d85cfa4 sdmmc, sdspi: fix initializers to be C++-compatible, add test
Closes https://github.com/espressif/esp-idf/issues/1861
Closes https://github.com/espressif/arduino-esp32/issues/1312
2018-04-23 14:35:13 +08:00
Flavio Bayer d477d3c5bd bugfix/sdspi_host.c: wrong CD/WP pin configuration
Looks like the configuration of CP and WP pins are wrong, since the check for `gpio_cd` and `gpio_wp` in `slot_config` seems to be swapped.
2018-04-23 11:32:42 +10:00
Ivan Grokhotkov 22fbcd276c Merge branch 'feature/amazon_freertos_compat_v2' into 'master'
Changes for Amazon Freertos compatibility

See merge request idf/esp-idf!2123
2018-04-20 14:55:47 +08:00
Ivan Grokhotkov 6185e722c3 Revert "Merge branch 'feature/vfs_select' into 'master'"
This reverts merge request !2074
2018-04-20 11:51:41 +08:00
Mahavir Jain 43a12894ea driver/spi: add _ISR counterparts if invoked from interrupt for critical section
Signed-off-by: Mahavir Jain <mahavir@espressif.com>
2018-04-19 18:28:55 +05:30
Ivan Grokhotkov 88d0d6ffb0 Merge branch 'feature/vfs_select' into 'master'
Allow VFS file descriptors in select()

See merge request idf/esp-idf!2074
2018-04-19 15:06:02 +08:00
Ivan Grokhotkov b297b72abb Merge branch 'bugfix/fix_gpio_install_isr_service_check_value' into 'master'
driver(gpio): modify return value when gpio ISR service already exists.

See merge request idf/esp-idf!2125
2018-04-19 15:01:50 +08:00
Roland Dobai 6852d653bd Allow VFS file descriptors in select() 2018-04-17 11:25:30 +02:00
Mahavir Jain 959c677025 rtc_module: fix build failure if assertions are disabled
Closes https://github.com/espressif/esp-idf/issues/1841

Signed-off-by: Mahavir Jain <mahavir@espressif.com>
2018-04-17 10:44:48 +05:30
Ivan Grokhotkov d3fd00c049 Merge branch 'bugfix/spi_miso_on_input_only_pins' into 'master'
fix(spi): allow to use MISO on GPIO34-39.

See merge request idf/esp-idf!2136
2018-04-16 14:39:02 +08:00
Angus Gratton 8b3fda99f5 Merge branch 'feature/uart_add_api_get_cmd_position' into 'master'
driver(uart): Add API to get the position of cmd_char

See merge request idf/esp-idf!2177
2018-04-16 08:03:25 +08:00
Wang Jia Lin 6c44fc70bc Merge branch 'feature/gpio_add_hold_support' into 'master'
driver(gpio):   Add api support digital pad hold function

See merge request idf/esp-idf!2186
2018-04-13 12:18:44 +08:00
Michael (Xiao Xufeng) 45f8bcf3f8 fix(spi): allow using MISO on GPIO34-39
Breaking Changes: arguments of ``spicommon_bus_initialize_io`` are changed.

Closes https://github.com/espressif/esp-idf/issues/1736.
2018-04-12 17:01:38 +08:00
Michael (Xiao Xufeng) 77629129c0 chore(spi): update the return value of spi init functions 2018-04-12 17:01:38 +08:00
Michael (Xiao Xufeng) dceb3452c7 doc(spi_master): format the documentation of several fields and macros in spi_master.h 2018-04-12 17:01:37 +08:00
kooho 2236249555 driver(pcnt): Add some APIs to support each unit can have it's own interrupt handler. 2018-04-11 16:15:09 +08:00
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
kooho ccf09c3b39 driver(gpio): Add api support digital pad hold function. 2018-04-10 11:31:59 +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
kooho 305c788c60 driver(uart): Add API to get the position of cmd_char 2018-04-03 12:34:16 +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
kooho 8e1f930582 driver(gpio): Modified the GPIO_CHECK's return value when ISR service already installed 2018-03-29 09:58:31 +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
Xu Chun Guang 973913b151 feat: Adjust log level about UART
There are too many log when UART baud is around 2Mbps if not use hard flow control.
2018-03-13 16:01:37 +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 3da8f2eda1 bugfix(touch): change the default value for sar_touch_enable register.
Reported from github: https://github.com/espressif/esp-idf/issues/1236

All the touch channels are enabled by default in hardware. This would interfere other RTC function on Touch IOs.
Disable touch function in touch_pad_init().
2018-01-29 15:40:21 +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
kooho 492db0591d Fix uart fifo overflow bug 2018-01-12 14:42:54 +08:00
Angus Gratton 2227c44254 rmt: Add void * argument for end-of-transmission callback
Ref https://github.com/espressif/esp-idf/pull/1174
2018-01-05 17:31:59 +11:00
Krzysztof Bociurko 1066c74b74 rmt: Adds a simple handler that can be called when transmission ends.
Merges https://github.com/espressif/esp-idf/pull/1174
2018-01-05 17:14:02 +11:00
Ivan Grokhotkov 30aacb79d5 Merge branch 'bugfix/uart_semaphore_pr1387' into 'master'
uart driver: Remove unnecessary xSemaphoreGive()

See merge request !1739
2018-01-05 11:05:05 +08:00
Angus Gratton 6e23ee704b Merge branch 'refactor/spi_clk_pre_cal' into 'master'
bugfix(spi_master): improve spi time cost for each transfer.

See merge request !1670
2018-01-04 06:03:12 +08:00
Alexey Morozov 25b8642835 uart driver: Remove unnecessary xSemaphoreGive()
avoid unnecessary call of xSemaphoreGive(p_uart_obj[uart_num]->tx_mux);

Merges https://github.com/espressif/esp-idf/pull/1387
2018-01-03 13:44:19 +11:00
Per Malmberg f7f52414ec Removed logging in RMT driver which skews the timing. Issue #1345
Merges https://github.com/espressif/esp-idf/pull/1450
2018-01-03 10:50:03 +11:00
Per Malmberg 5fb16d9b2b Fix regression in i2c_master_read() which rejected all data lenths. 2017-12-28 14:54:15 +01:00
michael 2552fdccd1 chore(spi): add log to show native pins or not when configure pins. 2017-12-28 12:03:29 +08:00
michael f4be6ac84d fix(spi_master): fix the logic in the ISR to prevent re-config registers when device is not changed. 2017-12-28 12:03:29 +08:00
michael 7a7b8fc182 refactor(spi_master): move the clock calculation from ISR to initialization. 2017-12-28 12:03:28 +08:00
Angus Gratton ec7cac5fe8 Merge branch 'feature/docs_update_rmt_api' into 'master'
RMT API docs update, new example

See merge request !1564
2017-12-27 09:23:47 +08:00
kooho d78be97154 add NACK for the last byte to read 2017-12-26 21:50:18 +08:00
Angus Gratton 661d584ae7 Merge branch 'bugfix/i2c_fixes_pr1180' into 'master'
i2c: rx <-> tx typo's, NULLing free'd variable, consistent CRITICAL sects

See merge request !1551
2017-12-18 06:44:33 +08:00
Angus Gratton 8f874aaa0f Merge branch 'bugfix/i2c_use_queue_instead_of_eventbit' into 'master'
bugfix(i2c): use queue instead of event group for internal commands

See merge request !1616
2017-12-15 13:54:03 +08:00
Chuck Todd d913fff6d7 i2c: rx <-> tx typo's, NULLing free'd variable, consistent CRITICAL sects
A couple of typos referencing tx_ring_buf when rx_ring_buf, slv_tx_mux
instead of slv_rx_mux.

Also, I2C_ENTER_CRITICAL()/I2C_EXIT_CRITICAL() usage was not consistent.
Only some of the _set_ functions had them.  Most of the _get_ function
had them?  It is my understanding that they should be wrapped around
writes, not reads? (I think we still need the lock for reading pairs of consistent values)

Also, the ticks_to_wait timeout handling in i2c_master_cmd_begin() would
not handle integer rollover correctly.

Merges https://github.com/espressif/esp-idf/pull/1180
2017-12-11 11:08:39 +08:00
Ivan Grokhotkov 269486ca4d sdspi: use response timeout passed from upper layer
Previously SDSPI host driver would rely on retry count when waiting for
the card to read or write data. This caused different timeout times
depending on CPU frequency and card clock frequency. In practice, card
performance does not depend on these two factors.
This change uses timeout_ms field of sdmmc_command_t introduced
previously for SDMMC host.

Fixes https://esp32.com/viewtopic.php?f=2&t=3440&p=16037 and similar
issues related to SDSPI timeouts.
2017-12-11 11:07:08 +08:00