2024-09-19 02:02 PM
Here's a corrected version of your text:
Hi!
I would like to ask the community if my design of the SDIO and USB bus looks fine. Previously, I was using a dev board (BlackPill STM32) to write data to an SD card, but I encountered some issues during the communication stage. The problem occurs when the SDIO protocol starts sending data at a 24 MHz frequency. When I try to write or read a block of data in common mode, without DMA and interrupt handling (IT), I always get a HAL_TIMEOUT error.
After researching the issue, I found that some people suggest it might be caused by incorrect SDIO bus design, specifically related to impedance and trace length control.
To address this, I redesigned the PCB. It now consists of four layers, with the top and bottom as signal layers, and the two middle layers as GND and VCC (which are not shown in the design). I hope you can review it and provide some feedback, whether positive or negative.
I have tried several variations of the code and tested it on another board (STM32 BlackBoard with an SD slot), where it works but only with a 10x SDIO_CK divider or higher. This fact also leads me to conclude that the initial design (BlackPill) used a chip SD adapter with an undefined wire length and impedances. Furthermore, I later discovered that the second design (BlackBoard) also had a few mistakes,like weird trace path through 2.54 contact row.
2024-09-19 02:32 PM - edited 2024-09-19 02:34 PM
> When I try to write or read a block of data in common mode, without DMA and interrupt handling (IT), I always get a HAL_TIMEOUT error.
It's probably more likely to be caused by the code being unable to keep up, causing an underflow and a bus error that manifests as a timeout. Especially if it works with DMA.
Layout looks good. Shouldn't have any issues operating at 24 MHz. Thick traces aren't necessary here, but aren't hurting either. Similar with length matching. Adding terminating resistors will add some amount of noise resistance but with short traces and without much else happening on the board shouldn't be necessary.
Consider putting a header connector on there and looking at the signals with a logic analyzer or scope. It will give you a lot more insight into what is going on at the hardware level.
> Here's a corrected version of your text:
??? Forget to delete that part of the AI response?
2024-09-19 03:30 PM
>It's probably more likely to be caused by the code being unable to keep up, causing an underflow and a bus error that manifests as a timeout. Especially if it works with DMA.
Thank you so much for your answer!
Actually, DMA doesn’t help; it just goes into an infinite loop, and the SD card status become BUSY.
>Layout looks good. Shouldn't have any issues operating at 24 MHz. Thick traces aren't necessary here, but aren't hurting either. Similar with length matching. Adding terminating resistors will add some amount of noise resistance but with short traces and without much else happening on the board shouldn't be necessary.
Thanks again! If everything is fine, I will proceed with manufacturing.
>Consider putting a header connector on there and looking at the signals with a logic analyzer or scope. It will give you a lot more insight into what is going on at the hardware level.
I was thinking about , but i want to try to keep signal part as clear as possible. I think will order two versions of PCB (with and without them)
>??? Forget to delete that part of the AI response?
In addition to being so good at electronic engineering (not sarcasm), you're also a pretty good detective:)
2024-09-20 03:42 AM
Hello @Photonic_nail
Potentially, as detailed @TDK something is missing in your software. Could you test with different SDIO clock dividers? About your HW design, did you make sure of controlled 90Ohms impedance? and ESD protection?
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2024-09-20 04:06 AM
As I said before , different clock divider works if it higher then X10 and only with BlackBoard.
90Ohms ? SDIO specification says that it's 50 Ohms .
2024-09-20 06:26 AM
90Ohms is USB requirement Introduction to USB hardware and PCB guidelines using STM32 MCUs - Application note
Please note that Black board is not ST board.
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.