Commit graph

364 commits

Author SHA1 Message Date
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
Fabiano Kovalski 9075b507b5 driver(i2c): corrected timeout range for i2c_set_timeout.
Merges https://github.com/espressif/esp-idf/pull/1353
2017-12-08 14:26:35 +08:00
krzychb 421592a8eb LEDC Driver: Added back original definitions of 'duty_resolution' and 'clock_divider'. This update is to provide backward compatibility with ESP-IDF 2.1. 2017-12-04 21:12:56 +01:00
Jiang Jiang Jian c672fc54fd Merge branch 'feature/ledc_more_meaningful_parameter_names' into 'master'
Provided more meaningful parameter names by renaming 'bit_num' to 'duty_resoluti…

See merge request !1440
2017-12-01 19:33:53 +08:00
krzychb 866b84b9f8 Typo fix. Closes https://github.com/espressif/esp-idf/issue/1323 2017-12-01 09:06:08 +01:00
Wangjialin bf3c41bb92 bugfix(i2c): use queue instead of event group for internal commands
Reported from github:
https://github.com/espressif/esp-idf/issues/1312
https://github.com/espressif/esp-idf/issues/1193

Issues:
1. We used to use event group in the driver, which would cause:
    a. longer operation time since the event group are based on FreeRTOS timer.
    b. Operation fails if the timer queue is not long enough.
2. There might be some issue with event group, we will still try to provide a small test code in other branch.

modification:
1. use queue instead of event-bit for internal commands
2. use queue overwrite for cmd_done event
2017-11-29 12:33:11 +08:00
Angus Gratton 5e7478a055 Merge branch 'bugfix/ledc_fade_scale' into 'master'
driver(LEDC): add scale value check in ledc_set_fade API

See merge request !1583
2017-11-27 07:23:19 +08:00
panfeng b553c925b1 bugfix: while scale equals 0 will cause crash 2017-11-23 17:56:18 +08:00
kooho ada33fe3dd Add GPIO input and output disable option 2017-11-22 15:00:27 +08:00
krzychb 2ec35f60ca RMT API docs update, new example 2017-11-21 22:34:23 +01:00
Ivan Grokhotkov 4b8f55aadf Merge branch 'bugfix/minor_fixes_github' into 'master'
Minor fixes from github

See merge request !1555
2017-11-20 15:58:34 +08:00
Angus Gratton f54e99008d spi: Add ESP_ERR_NO_MEM to spi_device_queue_trans() documentation
Ref https://github.com/espressif/esp-idf/pull/1243#issuecomment-343103414
2017-11-20 16:06:59 +11:00
michael 02573a8dc9 fix(spi_master): release temporary memory when queue new trans timeout. 2017-11-17 12:15:19 +08:00
michael 13d38f10ee test(spi): internal connection test master with slave for address and command field. 2017-11-17 12:15:19 +08:00
michael 57e1d47ad7 fix(spi_master): fix the CS pin issue with GPIO 0.
Closes #909
2017-11-17 12:15:19 +08:00
michael 842292523f fix(spi_slave): add interrupt free into bus free process. 2017-11-17 12:14:40 +08:00
Raphael Luba 31711b5ac7 SPI: Document TIMEOUT return values
`spi_device_queue_trans` and `spi_device_get_trans_result` can return `ESP_ERR_TIMEOUT` – but this had not been documented.

Merges https://github.com/espressif/esp-idf/pull/1243
2017-11-17 10:50:54 +11:00
krzychb d488bb7bac Provided more meaningful parameter names by renaming 'bit_num' to 'duty_resolution' and 'div_num' to 'clock_divider' 2017-11-15 08:08:12 +01:00
Ivan Grokhotkov da141a2c7e Merge branch 'bugfix/touch_pad_register_mismatch' into 'master'
Bugfix/touch pad register mismatch

See merge request !1469
2017-11-15 14:52:13 +08:00
Wangjialin 7200b2cc11 bugfix(touch): registers of touchpad 8 and 9 are mismatched
1. All the registers of touch sensor 8 and 9 are mismatched except the ‘dac’ field in touch register of RTC IO
2. To swap the index for sensor 8 and 9 in APIs.
2017-11-14 18:47:56 +08:00
Ivan Grokhotkov 09d2791cfd Merge branch 'feature/spi_variable_len' into 'master'
feat(spi_master): add new feature allow use variable command and address field length for the same device.

See merge request !1322
2017-11-14 00:08:50 +08:00
Ivan Grokhotkov 5404252e80 Merge branch 'bugfix/uart_fifo_bug_workaround' into 'master'
bugfix(uart): workaround for uart fifo reset issue

See merge request !1499
2017-11-13 17:46:42 +08:00
Wangjialin 4052803e16 bugfix(uart): workaround for uart fifo reset issue
Reported from github:
https://github.com/espressif/esp-idf/issues/1219
https://github.com/espressif/esp-idf/issues/1202

After providing a simple code to digital team, they confirmed that this is a hardware bug.

Root cause:
The fifo reset signal is incorrectly connected
If we want to reset tx fifo of UART2, we have to set txfifo_rst bit of both UART1 and UART2
If we want to reset rx fifo of UART2, we have to set rxfifo_rst bit of both UART1 and UART2

Workaround:
we don't use fifo rst bit in driver.

Documentation:
Digital team would update TRM and give more explanation about this issue.
2017-11-13 15:23:00 +08:00
Anton Maklakov 27c1fc52ba Added .command_timeout_ms = 0 to SDSPI_HOST_DEFAULT() too 2017-11-08 12:52:50 +08:00
Philip Ashmore d72bef02e9 Added .command_timeout_ms = 0 to SDMMC_HOST_DEFAULT() in components/driver/include/driver/sdmmc_host.h 2017-11-03 17:15:44 +08:00
XiaXiaotian 42cefc173f refractor WiFi clock setting
Do not set WiFi clock in PHY initializing function, move it to WiFi
   start/stop function.
2017-11-02 15:24:21 +08:00
wangmengyang bd6394db92 component/bt: clean up WIFI_CLK_EN_REG settings for Bluetooth
1. move settings of WIFI_CLK_EN_REG for bluetooth into controller init/deinit APIs
2. modify the bit mask used in phy_rf init/deinit to use WIFI-BT shared bits
2017-11-02 15:24:21 +08:00
michael 0330ec270a feat(spi_master): add new feature allow use variable command and address field length for the same device.
Closes #654
2017-10-30 19:33:41 +08:00
Angus Gratton 7c9b24b407 Merge branch 'bugfix/fix_uart_vfs_test_error' into 'master'
bugfix(uart): Don't disable console uart peripheral

See merge request !1456
2017-10-27 19:20:13 +08:00
Wangjialin 102eb96c8b bugfix(uart): Don't disable console UART peripheral 2017-10-27 16:46:10 +08:00
Angus Gratton ffeecde9e2 Merge branch 'feature/docs_update_timer_api' into 'master'
Timer API docs update, refactored example

See merge request !1316
2017-10-27 13:31:18 +08:00
krzychb 9b7d5d76a7 Timer API docs update, refactored example 2017-10-27 07:13:59 +02:00
Angus Gratton f5b3a370cd Merge branch 'feature/adc2_driver' into 'master'
feature(adc2): add support to use ADC2 when WIFI is disabled

See merge request !1237
2017-10-26 15:48:48 +08:00
michael 87f2b27dc4 refactor(rtc): re-organize code in rtc_module.c 2017-10-26 14:35:30 +08:00
michael d30f3e7aa8 example(adc2): add example and test case for adc2.
closes #461
2017-10-26 14:35:30 +08:00
esp32de 7c0020bfd0 feat(adc2): append adc2 support and api and the lock with WIFI module
append adc support and api
- esp_err_t adc2_config_width(adc_bits_width_t width_bit);
- esp_err_t adc2_config_channel_atten(adc2_channel_t channel, adc_atten_t atten);
- int adc2_get_voltage(adc2_channel_t channel);
2017-10-26 14:35:29 +08:00
Wangjialin 303b9f60db bugfix(uart): set default tx idle num
Reported from:
https://github.com/espressif/esp-idf/issues/703
https://github.com/espressif/esp-idf/issues/917
In uart driver we didn't change the default value of tx idle num, so there would be a delay after tx FIFO is empty.

1. Add API to set tx idle interval before next data transmission. (The UART hardware can add an interval after tx FIFO is empty).
2. Set default tx idle interval to zero.
3. Add hardware disable in uart driver delete function.
2017-10-25 13:29:02 +08:00
michael a6ac5b33c9 feat(rtc): open adc*(dac)_pad_get_io_num functions to public. 2017-10-24 12:06:14 +08:00
michael cff8d30c25 refactor(rtc): change register writing from macros to structures in *_struct.h 2017-10-24 12:05:52 +08:00
Angus Gratton 01befe4d6a Merge branch 'bugfix/i2c_hw_fsm_recover' into 'master'
bugfix(i2c): add I2C hardware reset if the hw FSM get stuck

See merge request !1272
2017-10-23 10:16:02 +08:00
Ivan Grokhotkov f039aac1e5 Merge branch 'bugfix/i2s_bck_polariy' into 'master'
bugfix(i2s): fix bck polarity issue when using pll clock.

See merge request !1428
2017-10-22 12:36:27 +08:00
Ivan Grokhotkov 000a4f5941 Merge branch 'bugfix/rmt_thresh_check' into 'master'
bugfix(rmt): fix event thresh check issue

See merge request !1423
2017-10-22 12:35:44 +08:00
Ivan Grokhotkov 59b7d98fec Merge branch 'feature/dfs' into 'master'
Dynamic frequency scaling

See merge request !1189
2017-10-22 12:34:11 +08:00
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
Ivan Grokhotkov b6f37bda97 Merge branch 'feature/i2s_built_in_adc' into 'master'
feature(I2S-ADC): add ADC mode for I2S.

See merge request !1077
2017-10-20 15:52:56 +08:00
Angus Gratton 477ed8ce62 Merge branch 'bugfix/touchpad_dac_mismatch_on_tp8_tp9' into 'master'
bugfix(touch): add workaround for touch pad DAC hardware source mismatch on tp8 and tp9.

See merge request !1288
2017-10-20 14:18:32 +08:00
Wangjialin a84db78eb1 bugfix(i2s): fix bck polarity issue when using pll clock.
reported from github: https://github.com/espressif/esp-idf/issues/1119

Digital team think it is due to the decimal divider.
We can reset the i2s tx and rx when calling i2s_stop to avoid this.
2017-10-19 23:23:01 +08:00
Wangjialin ab1abff080 bugfix(rmt): fix event thresh check issue
reported from: https://github.com/espressif/esp-idf/issues/1011

1. Fix event thresh check issue
2. Change IO number in example in case it conflicts with GPIO16(psram cs pin).
2017-10-18 18:49:09 +08:00
Ivan Grokhotkov 5048d38ce7 spi slave: lock APB frequency while driver is in use 2017-10-18 14:37:21 +08:00
Ivan Grokhotkov e4616588b7 spi master: lock APB frequency while in transaction 2017-10-18 14:19:21 +08:00
Ivan Grokhotkov 330b6bd668 sdmmc: lock APB frequency while in transaction 2017-10-18 14:19:20 +08:00
Ivan Grokhotkov fba9678c56 uart: add support for REF_TICK 2017-10-18 14:19:20 +08:00
Gabriel Carstoiu 8128bb95ef fix(spi_slave): enable DMA clock when initialization.
merging in the code updates to the SPI master code done in commit b834fcf78a.

TW#15670, Closes #1027
2017-10-17 12:20:40 +08:00
michael 88f602a0e0 fix(periph_ctrl): fix reset function in periph_ctrl.c 2017-10-17 12:20:40 +08:00
michael 8e31a36562 feat(spi_slave): append trans_len field in trans_desc to show length actually transferred. 2017-10-17 12:01:12 +08:00
Ivan Grokhotkov edb212986f Merge branch 'bugfix/sd_card_fixes' into 'master'
SD card fixes

See merge request !1393
2017-10-17 04:45:24 +08:00
Angus Gratton 0a52dbccca Merge branch 'bugfix/spi_reset_race' into 'master'
periph_ctrl: Refactor to add periph_module_reset(), avoid potential race in SPI DMA workaround

See merge request !1349
2017-10-13 08:51:36 +08:00
Ivan Grokhotkov 3cf23ff77d sdmmc: allow command timeouts to be configured
Previously the timeout was set to the same value (1000ms) for all kinds
of commands. In some cases, such as with slow cards, write commands
failed to complete in time.
This change makes command timeouts configurable via sdmmc_host_t
structure, and also makes default timeouts different for ordinary
commands and write commands.

Closes https://github.com/espressif/esp-idf/issues/1093

Ref TW15774.
2017-10-13 08:16:07 +08:00
Jiang Jiang Jian 8e47c355fa Merge branch 'feature/i2s_apll' into 'master'
driver/i2s: add support apll clock

See merge request !1115
2017-10-12 19:06:50 +08:00
Jiang Jiang Jian e0922c9564 Merge branch 'bugfix/i2s_set_pin_valid_gpio' into 'master'
change to GPIO_IS_VALID_OUTPUT_GPIO for data out pin

See merge request !764
2017-10-12 18:21:25 +08:00
Jiang Jiang Jian da247c2cf8 Merge branch 'bugfix/ledc_duty_type_change' into 'master'
ledc_get_duty return type changed from int to uint32_t, target_duty changed from int to uint32_t

See merge request !752
2017-10-12 18:18:33 +08:00
Jeroen Domburg a8131b14b0 Merge branch 'feature/docs_update_uart_api' into 'master'
Updated functional overview of UART API documentation

See merge request !1328
2017-10-10 14:06:08 +08:00
Jeroen Domburg 1835c3a213 Merge branch 'feature/docs_update_pcnt_api' into 'master'
Extended description of the Pulse Counter API and removed redundant comments from the example

See merge request !1312
2017-10-10 14:06:03 +08:00
krzychb 9107b47deb Updated UART API documentation and examples. Included a fix of #1091 from GitHub 2017-10-10 05:54:36 +02:00
Tuan PM 9d39881981 i2s: add support apll clock
using apll_param to setup APLL

new apll calculation method, much faster

validate freq calculation

Ensure that the i2s frequency is greater than the hardware limit

Add description of how to calculate apll clock, support apll for other 16-bits audio, check rev0 chip

correct space
2017-10-06 15:36:24 +07:00
Angus Gratton 0dd9b899b7 periph_ctrl: Refactor to add periph_module_reset(), avoid potential race in SPI DMA workaround
Also refactor use of direct clock access in unit test ref_clock (probably not a real issue)
2017-10-02 17:48:16 +11:00
michael fcd0f52e21 test(spi_master): add test case for 3 DMA issues with internal connection by gpio mux.
3 issues are:
1. RX buffer not aligned (start and end)
2. not setting rx_buffer
3. setting rx_length != length

also add spi release code here.
2017-09-27 10:44:28 +08:00
krzychb e69691427c Extended description of the Pulse Counter API and removed redundant comments from the example 2017-09-26 22:44:46 +02:00
krzychb b5e4c76bfe Updated sigma delta API documenation and example 2017-09-25 21:31:09 +02:00
Ivan Grokhotkov 64d1f947ed driver/rtc: fix copy-paste error in HOLD_FORCE field name for GPIO26
This error prevented EXT1 wakeup using GPIO26 from working.
2017-09-21 12:26:03 +08:00
Simon Werner 45ad0cdda2 Improved uart_flush() documentation.
Improved `uart_flush()` documentation based on this discussion: https://esp32.com/viewtopic.php?f=13&t=2804&p=13377&hilit=uart_flush#p13373

Merges https://github.com/espressif/esp-idf/pull/970
2017-09-20 12:09:44 +10:00
Wangjialin 449f9e10a3 bugfix(touch): add workaround for touch pad DAC hardware source mismatch on tp8 and tp9. 2017-09-19 20:10:39 +08:00
michael 1b91cb7be0 fix(sdspi): fix issues causing the sdspi driver to work low efficiently with DMA. 2017-09-19 19:00:47 +08:00
michael 074f36afff fix(spi_master): fix the heap corruption bug that RX DMA writes over the temporary buffer boundary.
TW#15434

Closes #994.
2017-09-19 16:47:14 +08:00
Kewal Shah 379320bdb2 change to GPIO_IS_VALID_OUTPUT_GPIO for data out pin 2017-09-14 13:33:39 +08:00
Wangjialin 2fceec4d85 feature(I2S-ADC): add ADC mode for I2S.
1. Support built-in ADC for I2S.
2. Modify code of ADC, made no change to the original APIs.
3. Add APIs in I2S:
esp_err_t i2s_set_adc_mode(adc_unit_t adc_unit, adc1_channel_t adc_channel);
4. Add I2S ADC/DAC example code.
5. add old-fashion definition to make it more compatible
6. replase spi_flash_ APIs with esp_partition_ APIs
7. add example of generating audio table from wav
8. change example sound
2017-09-14 13:24:08 +08:00
Kewal Shah c4f15a0e5d ledc_get_duty return type changed from int to uint32_t, target_duty changed from int to uint32_t 2017-09-13 01:43:42 +08:00
Ivan Grokhotkov 23f10e1a57 Merge branch 'feature/uart_software_flow_control' into 'master'
uart: Add api call to switch on hardware support for 'software' flow control. (github #890)

See merge request !1215
2017-09-12 12:11:11 +08:00
Ivan Grokhotkov de038f502c Merge branch 'feature/gpio_channel_macro' into 'master'
feat(global): add macros for GPIO->channel lookup

See merge request !1170
2017-09-11 12:15:08 +08:00
Ivan Grokhotkov e12967297d Merge branch 'feature/docs_touch_pad_api' into 'master'
Touch Pad driver overview

See merge request !1195
2017-09-08 11:55:27 +08:00
Ivan Grokhotkov 3c470e7c43 Merge branch 'bugfix/rmt' into 'master'
RMT 2 fixes: Rename one API and specify wait_time in another API

See merge request !896
2017-09-07 18:03:08 +08:00
michael 08b9fbc242 feat(global): add macros for GPIO->channel lookup
including: macros for dac, adc, touch, rtc_gpio, uart and clk_out.

TW#13970
2017-09-07 10:40:25 +08:00
Alex Burr 93cc3a77cb uart: Add api call to switch on hardware support for 'software' flow control.
Cherry-picks https://github.com/espressif/esp-idf/pull/890
2017-09-05 16:30:21 +10:00
krzychb ba42c46cb3 Touch Pad driver overview 2017-09-05 08:28:44 +02:00
Ivan Grokhotkov b38186dc43 sdmmc: use periph_ctrl to enable peripheral when initializing the host 2017-09-04 22:43:52 +08:00
Ivan Grokhotkov 956a28a95c driver: add periph_ctrl support for SDMMC, SDIO slave, CAN, EMAC 2017-09-04 22:43:51 +08:00
michael b834fcf78a fix(spi_master): this fix the SPI MOSI output missing bug. 2017-09-04 22:43:51 +08:00
Jeroen Domburg fe140fe347 Fix off-by-one in 5MBaud arg checking; propagate errors better 2017-09-01 12:15:28 +08:00
Ivan Grokhotkov 1cfe96b1d7 Merge branch 'bugfix/i2s_dac_channel' into 'master'
fix(i2s_dac): fix the disable function which only disables DAC_CHANNEL_1.

See merge request !1169
2017-08-31 10:45:30 +08:00
Ivan Grokhotkov b4857fc159 Merge branch 'bugfix/memory_issues_pr838' into 'master'
vfat, i2s, mdns: Fix two memory leaks, one double free (github #838)

See merge request !1173
2017-08-31 10:45:19 +08:00
Angus Gratton 96f9ae3e30 Merge branch 'bugfix/minor_prs_github' into 'master'
Minor bugfixes and corrections from github

See merge request !1181
2017-08-31 07:11:30 +08:00
Angus Gratton 4f812eb29c Remove redundant code line from uart.c
Merges part of https://github.com/espressif/esp-idf/pull/650
2017-08-30 17:55:00 +10:00
Simon Werner c8d8fb58e7 Fixed incorrect value in comments for GPIO_NUM_33.
Merges https://github.com/espressif/esp-idf/pull/676
2017-08-30 17:55:00 +10:00
Henrik Maier 95fe7929c0 Fix spinlock bug for uart_set_rts and uart_set_dtr
Merges https://github.com/espressif/esp-idf/pull/649
2017-08-30 15:32:23 +10:00
Quentin Thérond 36eccee213 i2s: fix leak in i2s_create_dma_queue if we have a malloc issue. 2017-08-30 12:11:03 +10:00