Open jdavid opened 1 year ago
For the record this is the (uncommitted) changeset in RIOT:
diff --git boards/lora-e5-dev/include/board.h boards/lora-e5-dev/include/board.h
index 66dae373cb..de0d2bf6fa 100644
--- boards/lora-e5-dev/include/board.h
+++ boards/lora-e5-dev/include/board.h
@@ -91,6 +91,23 @@ extern void lora_e5_dev_sx126x_set_rf_mode(sx126x_t *dev, sx126x_rf_mode_t rf_mo
*/
#define LORA_E5_DEV_5V_ENABLE_PIN GPIO_PIN(PORT_B, 10)
+
+
+#define SPI_CS GPIO_PIN(PORT_B, 9)
+#define SPI_SCLK GPIO_PIN(PORT_B, 13)
+#define SPI_MOSI GPIO_PIN(PORT_A, 10)
+#define SPI_MISO GPIO_PIN(PORT_B, 14)
+
+#define SDCARD_SPI_PARAM_SPI SPI_DEV(0) /**< SPI device */
+#define SDCARD_SPI_PARAM_CS SPI_CS /**< Chip Select */
+#define SDCARD_SPI_PARAM_CLK SPI_SCLK /**< Serial Clock */
+#define SDCARD_SPI_PARAM_MOSI SPI_MOSI /**< Master Output, Slave Input */
+#define SDCARD_SPI_PARAM_MISO SPI_MISO /**< Master Input, Slave Output */
+//#define SDCARD_SPI_PARAM_POWER MEM_PW /**< Powen on/off */
+//#define SDCARD_SPI_PARAM_POWER_AH (true) /**< Power on with power pin high */
+
+
+
#ifdef __cplusplus
}
#endif
diff --git drivers/sdcard_spi/sdcard_spi.c drivers/sdcard_spi/sdcard_spi.c
index 62d19bf903..219cecf0d9 100644
--- drivers/sdcard_spi/sdcard_spi.c
+++ drivers/sdcard_spi/sdcard_spi.c
@@ -17,7 +17,7 @@
*
* @}
*/
-#define ENABLE_DEBUG 0
+#define ENABLE_DEBUG 1
#include "debug.h"
#include "sdcard_spi_internal.h"
#include "sdcard_spi.h"
I have tried with the Arduino IDE and Arduino UNO following https://circuitstate.com/tutorials/interfacing-catalex-micro-sd-card-module-with-arduino/ and it worked.
For the record this is the output with latest version (2.2.0) of the SdFat library (program File > Examples > SdFat > SdInfo):
init time: 2 ms
Card type: SD2
sdSpecVer: 3.00
HighSpeedMode: true
Manufacturer ID: 0X74
OEM ID: J`
Product: USD
Revision: 1.0
Serial number: 0X4276B805
Manufacturing date: 7/2017
cardSize: 2008.02 MB (MB = 1,000,000 bytes)
flashEraseSize: 128 blocks
eraseSingleBlock: true
dataAfterErase: zeros
OCR: 0X80FF8000
SD Partition Table
part,boot,bgnCHS[3],type,endCHS[3],start,length
1,0X0,0X4,0X4,0X0,0X6,0X2C,0XEC,0XCC,255,3921665
2,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0
3,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0
4,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0
Scanning FAT, please wait.
Volume is FAT16
sectorsPerCluster: 64
fatStartSector: 256
dataStartSector: 768
clusterCount: 61268
freeClusterCount: 61254
For the record:
Could not test Arduino's example with the Arduino Zero because cannot flash anymore. I think it's because with RIOT I use system's openocd 0.11 while the Arduino IDE uses openocd 0.10
Could not test RIOT's tests/driver_sdcard_spi
program with Arduino UNO because doesn't have enough program memory
Saw that in lora-e5-dev button D0 and SPI SCK use the same PB13 pin, so I disabled the button D0 with the jumper, but it did not change anything.
The error we have is that CMD0 works byt CMD59 times out. If I unplug any cable then CMD0 doesn't work. Except for MOSI, which doesn't make any difference (CMD0 ok CMD59 ko). Tried to plug the MOSI cable to D9 with no change.
I ordered this card reader https://circuitstate.com/tutorials/interfacing-catalex-micro-sd-card-module-with-arduino/ to work with the LoRa E5 board. But didn't get it to work yet.