Open dombru54 opened 2 years ago
thanks for the note - we'll fix this on the next PCB run!
Howdy @dombru54 , thanks for your work, i just purchased two feathers from here, and i quickly found the same problem (fixed with your same solution)
I dont see any Hardware revision markings in my boards, so there is no way for me to guess if either berrybase had old stock or this error wasnt fixed yet (for sure isnt fixed in adafruits repo).
@javiBajoCero , It is with great pleasure that I welcome your return, my friend. I also invite you to see another of my work on the Oled feather https://github.com/adafruit/Adafruit-OLED-FeatherWing-PCB/issues/10 Best regards
@javiBajoCero , In addition, if you work with STM32CubeIDE, you must modify : ".....\STM32CubeIDE\workspace_1.8.0\project\FATFS\Target\fatfs_platform.c"
uint8_t BSP_PlatformIsDetected(void) {
uint8_t status = SD_PRESENT;
/* Check SD card detect pin */
if(HAL_GPIO_ReadPin(SD_DETECT_GPIO_PORT, SD_DETECT_PIN) != GPIO_PIN_RESET)
{
status = SD_NOT_PRESENT;
}
/* USER CODE BEGIN 1 */
/* user code can be inserted here */
// Correction de l'erreur génèrée dans le code par MX, au dessus
if(HAL_GPIO_ReadPin(SD_DETECT_GPIO_PORT, SD_DETECT_PIN) == GPIO_PIN_SET){ // carte présente = 1 (SET)
status = SD_PRESENT;
}
/* USER CODE END 1 */
return status;
Thanks for your advice, i was trying to make SD+SDIO(4bits) work but, two days later, still nothing. (for context i have developed SD+SPI projects in the past)
It doesnt work for me with STM32 HAL CUbeMX based, not even when i switched to arduino to test my sanity
I know statistically im messing up something in my code but seeing they missed this SD detection Gpio, im starting to be afraid they didnt tested the SD at all .
If you have any more clues or repos with working code let me know
@javiBajoCero , All the SDIO 4 bits mode works on the Feather ! but .... "two days later, still nothing." .... normal ... ;>) .... SDIO is very poorly documented. I struggled for more than a week before having all the elements !!! 1) SDIO clock is based on USB clock at 48MHz.
2) After, you must use a divider with ClockDiv = 3 , especially not another value ... for me SDIO_CK = SDIOCLK / (2 + CLKDIV) => SDIO_CK = 48MHz/(2+3) = 9.6 MHz
static void MX_SDIO_SD_Init(void) {
hsd.Instance = SDIO;
hsd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING;
hsd.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE;
hsd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE;
hsd.Init.BusWide = SDIO_BUS_WIDE_1B;
hsd.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_DISABLE;
hsd.Init.ClockDiv = 3; }
@javiBajoCero ,
3) For good precision, it is more than recommended to use the 2 quartz, therefore the 2 LSE and HSE modes.
void SystemClock_Config(void) {
.......
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE|RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
.......
@javiBajoCero , Feather has a trap about its serigraphy, 2 "Bats" with 2 different functions, one for powering on LiPo connector and the other on backing up the RTC.
@javiBajoCero ,
Hi @dombru54 , first thanks for all of your tips, they are gold!
I got it to work yesterday, my problems were ;
About your tips:
I see youre using a super old version of cubeMX, why is that?
In my Cube version i cannot se any SDIO dedicated box in the clock graphic config tool. I tought the SDIO was clocked with the APB2 peripheral clock. i am not enabling the USB and SDIO works as expected.
2.After, you must use a divider with ClockDiv = 3 , especially not another value ... for me
bingo, this was one of the problems i had, apparently SDIO really dislikes being clocked further than 24Mhz as my APB2 is clocked to 84Mhz by using a divide factor of 4 i get 14Mhz for the SDIO and it works.
3.For good precision, it is more than recommended to use the 2 quartz, therefore the 2 LSE and HSE modes.
I had this present since the start, always HSE (xtal), my last job consisted in 2 painfull years of mitigating the cathastrophic decision someone had using a HSI for automotive CANbus connected systems. (because it worked for them in the lab)
4.4. For the SDIO to work, you must activate the USB pins, maybe to run USB clock.
Thanks for sharing your design!, i didnt need to enable the USB for my progect to work tough, check it out in here https://github.com/javiBajoCero/featherSDcardTests
Hello @javiBajoCero , Thanks for sharing your experience.
I'm happy for you, Thanks for RM0090, but i'm surprised. page 1022 :
HSE is also very important for the PDM bus with microphones (ultrasonic acoustic spectrum aliasing of decimation).
Thank you for this surprising information.
Hope to read you soon
Hello @javiBajoCero ,
SYL
Its my first time working with stm32's F4 family, so i was just clicking my way with cubeMx doing all the clock configs.
SDIO is indeed very poorly documented. It seems SDIO uses indeed two different clocks comming from two different places, one for the APB interface and another for the "adapter".
So my guess is , cubeMX is enabling the SDIOCLK somwhere for me. No clue of where PLL48CLK is, there is a lack of consistent naming in these stm ap notes. It looks to me , somewhere, there is a PLL48CLK from which USB and SDIO clocks would come from, USB would only work with sharp 48Mhz so if enabled, all the rest of peripherals whose clock comes from PLL48CLK will need to work with 48Mhz as well. No idea where PLL48CLK is but for sure is available without initialising USB.
Hello @javiBajoCero , In one of your repo first page, you can add our sharing ... a gold mine .... ;>) ... SYL
Hello @javiBajoCero , if you like "Feather factor form", you must absolutely see the great "Swan Blues Wireless", STM32L4R5 : https://blues.io/products/swan/ https://www.hackster.io/news/swan-from-blues-wireless-is-the-most-expandable-feather-compatible-board-to-date-01132f5a0a91 https://github.com/gauteh/swan-stm32l4r5-quickstart https://blog.adafruit.com/2021/09/30/the-blues-wireless-swan-a-feather-board-based-on-the-stm32l4r5-feather-blueswireless/
Version 1.7 : Multi-layers board, V1.7, it exists Version 3.0 :
In one of your repo first page, you can add our sharing ... a gold mine .... ;>) ...
I didnt understood that sorry.
"Swan Blues Wireless"
this looks very nice!!! i will stick with adafruit feather tough. I just wanted some hardware to test my code before spending money manufacturing my own thing. I dont care much about the form factor, i just wanted some STMf4 with a Sd card and neopixel.
Hello @javiBajoCero , In one of your repo first page, you can add our sharing ... a gold mine .... ;>) ...
Sorry, most directly, you could insert the link to this issue in the file "readme.md" of https://github.com/javiBajoCero/featherSDcardTests ... This might help a reader of your repo.
Neopixel ... I understand why : https://www.hackster.io/javier-munoz-saez/coding-your-own-neopixel-driver-baremetal-stm32-b6b4d0
You say : "fatfs library doesnt like to be breakpointed by the debugger" : strange, maybe due to an interraction between Debugger clock and SDIO clocks ... I never had this problem.
SYS
Hi all!
Trying to use the SD card on this board over SDIO within ST32duino. We can program the board and get data from an MSA311 over the qic connect, but we can't get SD.begin() to work. Initially, it would hang for a long time at this step (multiple seconds), and then fail. We think we found the letter "B" with a circle around it on the board, suggesting this was a Rev B board with the card detect trace error. We cut that trace with an exacto. Now, it fails much more quickly. Our hypotheses as to the problem are:
Details of each are:
setup: SD.setDX(PC8,PC9,PC10,PC11); SD.setCK(PC12); SD.setCMD(PD2); if (!SD.begin(PB12)) { // detect Serial.println('failure to init'); while(1); }
we are not including a PinName library - but it compiles so I assume that's ok...
We have a 120gb SD card. In windows, we erased all partitions and created a single 3.5 gb fat32 partition. we did not alter the partition table.
The fact that the boot time/error time changed after we cut the trace suggested it did something, but it still gives an error on startup. We dont have a known good SD card around to try.
It would be very useful to hear from anyone who has gotten this working with code similar to the above for setting the pins, and with just cutting the trace.
If we need to mess with changing things in libraries or adjusting clock timings, then i think we'll just stack an adalogger feather wing on it and communicate with the SD card via SPI or something simpler.
Thank you for any input!
Hello,
I think that if the card had been revised, I would have been warned.
First, verify PB12 pin (cardDetect) with voltmeter.
Sorry, i don't know STM32duino, i just use STM32codeIDE. Maybe, you must modify a part of your library ... (insert correction code between user code balises) as this :
".....\STM32CubeIDE\workspace_1.8.0\project\FATFS\Target\fatfs_platform.c"
uint8_t BSP_PlatformIsDetected(void) {
uint8_t status = SD_PRESENT;
/* Check SD card detect pin */
if(HAL_GPIO_ReadPin(SD_DETECT_GPIO_PORT, SD_DETECT_PIN) != GPIO_PIN_RESET)
{
status = SD_NOT_PRESENT;
}
/* USER CODE BEGIN 1 */
/* user code can be inserted here */
// Correction de l'erreur génèrée dans le code par MX, au dessus
if(HAL_GPIO_ReadPin(SD_DETECT_GPIO_PORT, SD_DETECT_PIN) == GPIO_PIN_SET){ // carte présente = 1 (SET)
status = SD_PRESENT;
}
/* USER CODE END 1 */
return status;
Hi @javiBajoCero,
Did you finally manage to make the SD card work?
I'm at the same standpoint. I started the discussion and shared my observations in here: https://forums.adafruit.com/viewtopic.php?p=1031343#p1031343
Hi @javiBajoCero,
Did you finally manage to make the SD card work?
I'm at the same standpoint. I started the discussion and shared my observations in here: https://forums.adafruit.com/viewtopic.php?p=1031343#p1031343
yup, i managed https://github.com/javiBajoCero/featherSDcardTests
Hello,
With your STM32F405 Feather Express card, the PB12 pin (cardDetect) is always to 0 (GND). This is due to a short circuit with the card reader double pin 10
Error in the card reader manufacturer's datasheet and red correction
With actual PCB, cut ground track with a scalpel, at the edge of the metal case
Thanks to make a revision of this board .