Skip to content
This repository was archived by the owner on Aug 23, 2024. It is now read-only.

Commit 1996d7b

Browse files
committed
Updated esp-idf
commit: bae9709 (Apr 11, 2018) fullSHA: bae9709a7950e2ee08e14c65be27831bcb547105 Improved initialization of SD card it should be possible to connect SD cards without external pull-ups
1 parent f6297a5 commit 1996d7b

22 files changed

Lines changed: 34 additions & 27 deletions

MicroPython_BUILD/BUILD.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848

4949

5050
#=======================
51-
TOOLS_VER=ver20180408.id
51+
TOOLS_VER=ver20180412.id
5252
#=======================
5353

5454
# -----------------------------

MicroPython_BUILD/components/micropython/esp32/mpversion.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@
2424
* THE SOFTWARE.
2525
*/
2626

27-
#define MICROPY_GIT_TAG "ESP32_LoBo_v3.2.7"
28-
#define MICROPY_GIT_HASH "gf586f5e6"
27+
#define MICROPY_GIT_TAG "ESP32_LoBo_v3.2.9"
28+
#define MICROPY_GIT_HASH "gbae9709a"
2929
#define MICROPY_BUILD_DATE "2018-04-12"
3030
#define MICROPY_VERSION_MAJOR (3)
3131
#define MICROPY_VERSION_MINOR (2)
32-
#define MICROPY_VERSION_MICRO (7)
33-
#define MICROPY_VERSION_STRING "3.2.7"
32+
#define MICROPY_VERSION_MICRO (9)
33+
#define MICROPY_VERSION_STRING "3.2.9"
3434
#define MICROPY_CORE_VERSION "59dda71"
3535
#define MICROPY_CORE_DATE "2018-04-10"

MicroPython_BUILD/components/micropython/extmod/vfs_native.c

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -712,6 +712,31 @@ STATIC void sdcard_print_info(const sdmmc_card_t* card, int mode)
712712
#endif
713713
}
714714

715+
//--------------------------------------------------------------
716+
static void _setPins(int8_t p1, int8_t p2, int8_t p3, int8_t p4)
717+
{
718+
if (p1 >= 0) {
719+
gpio_pad_select_gpio(p1);
720+
gpio_set_direction(p1, GPIO_MODE_INPUT);
721+
gpio_set_pull_mode(p1, GPIO_PULLUP_ONLY);
722+
}
723+
if (p2 >= 0) {
724+
gpio_pad_select_gpio(p2);
725+
gpio_set_direction(p2, GPIO_MODE_INPUT);
726+
gpio_set_pull_mode(p2, GPIO_PULLUP_ONLY);
727+
}
728+
if (p3 >= 0) {
729+
gpio_pad_select_gpio(p3);
730+
gpio_set_direction(p3, GPIO_MODE_INPUT);
731+
gpio_set_pull_mode(p3, GPIO_PULLUP_ONLY);
732+
}
733+
if (p4 >= 0) {
734+
gpio_pad_select_gpio(p4);
735+
gpio_set_direction(p4, GPIO_MODE_INPUT);
736+
gpio_set_pull_mode(p4, GPIO_PULLUP_ONLY);
737+
}
738+
}
739+
715740
//-------------------------
716741
static void _sdcard_mount()
717742
{
@@ -729,17 +754,9 @@ static void _sdcard_mount()
729754
sdspi_slot_config_t slot_config = SDSPI_SLOT_CONFIG_DEFAULT();
730755
host.slot = VSPI_HOST;
731756
host.max_freq_khz = SDMMC_FREQ_HIGHSPEED;
732-
733757
slot_config.dma_channel = 2;
734-
gpio_pad_select_gpio(sdcard_config.miso);
735-
gpio_pad_select_gpio(sdcard_config.mosi);
736-
gpio_pad_select_gpio(sdcard_config.clk);
737-
gpio_pad_select_gpio(sdcard_config.cs);
738-
gpio_set_direction(sdcard_config.miso, GPIO_MODE_INPUT);
739-
gpio_set_pull_mode(sdcard_config.miso, GPIO_PULLUP_ONLY);
740-
gpio_set_pull_mode(sdcard_config.clk, GPIO_PULLUP_ONLY);
741-
gpio_set_pull_mode(sdcard_config.mosi, GPIO_PULLUP_ONLY);
742-
gpio_set_pull_mode(sdcard_config.cs, GPIO_PULLUP_ONLY);
758+
_setPins(sdcard_config.miso, sdcard_config.mosi, sdcard_config.clk, sdcard_config.cs);
759+
743760
slot_config.gpio_miso = sdcard_config.miso;
744761
slot_config.gpio_mosi = sdcard_config.mosi;
745762
slot_config.gpio_sck = sdcard_config.clk;
@@ -750,25 +767,15 @@ static void _sdcard_mount()
750767
sdmmc_host_t host = SDMMC_HOST_DEFAULT();
751768
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();
752769
host.max_freq_khz = SDMMC_FREQ_HIGHSPEED;
753-
gpio_pad_select_gpio(2);
754-
gpio_pad_select_gpio(14);
755-
gpio_pad_select_gpio(15);
756-
gpio_set_pull_mode(2, GPIO_PULLUP_ONLY);
757-
gpio_set_pull_mode(14, GPIO_PULLUP_ONLY);
758-
gpio_set_pull_mode(15, GPIO_PULLUP_ONLY);
770+
_setPins(2, 14, 15, 13);
759771
if (sdcard_config.mode == 2) {
760772
// Use 1-line SD mode
761773
host.flags = SDMMC_HOST_FLAG_1BIT;
762774
slot_config.width = 1;
763775
}
764776
else {
765777
// Use 4-line SD mode
766-
gpio_pad_select_gpio(4);
767-
gpio_pad_select_gpio(12);
768-
gpio_pad_select_gpio(13);
769-
gpio_set_pull_mode(4, GPIO_PULLUP_ONLY);
770-
gpio_set_pull_mode(12, GPIO_PULLUP_ONLY);
771-
gpio_set_pull_mode(13, GPIO_PULLUP_ONLY);
778+
_setPins(4, 12, -1, -1);
772779
}
773780
ret = esp_vfs_fat_sdmmc_mount(VFS_NATIVE_SDCARD_MOUNT_POINT, &host, &slot_config, &mount_config, &sdmmc_card);
774781
}
2.09 KB
Binary file not shown.
2.13 KB
Binary file not shown.
2.23 KB
Binary file not shown.
2.24 KB
Binary file not shown.
1.86 KB
Binary file not shown.
2.36 KB
Binary file not shown.
4.27 KB
Binary file not shown.

0 commit comments

Comments
 (0)