Hi,
I'm currently looking into correctly implementing card detection for the Olimex STM32P107. This card slot has no dedicated card detect signal and uses the CS signal which is pulled low via a 1M resistor on the board and "overwritten" by the pull-up of the card.
Now, I do not see an obvious way on how to implement the card detect call, since it is called periodically by the MMC driver, independent of its current state. So I cannot reconfigure the SPI NSS/CS output as an input during read/write transactions to read the pull-up. Has anybody solved this problem already?
Best,
Matthias
micro SD slots with no card detect signal
Re: micro SD slots with no card detect signal
I am not sure if this is even related, but I want to come up with this here:
I don't have the Olimex P107 board, but another board with an SD card slot. The example works fine when porting the board files. I have just one problem: When inserting the SD card, the function called by the event does get called (LED debugging ), but the card doesen't get mounted 80% of the time (fs_ready is false). I have to reset the board then and take another try. Sometimes I have to do that five times.
When I take the card out and put it back in again, InsertHandler dosen't get called again.
But as I said, when the card gets mounted successfully, everything works great.
Ideas?
~ Tectu
I don't have the Olimex P107 board, but another board with an SD card slot. The example works fine when porting the board files. I have just one problem: When inserting the SD card, the function called by the event does get called (LED debugging ), but the card doesen't get mounted 80% of the time (fs_ready is false). I have to reset the board then and take another try. Sometimes I have to do that five times.
When I take the card out and put it back in again, InsertHandler dosen't get called again.
But as I said, when the card gets mounted successfully, everything works great.
Ideas?
~ Tectu
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: micro SD slots with no card detect signal
This is the same on newer Olimex boards. One possible solution is to make the MMC_SPI driver work like the SDC one and do not poll that input all the time. Making those two drivers behave in a more similar way would be a good idea anyway.
I'll give it a try tomorrow.
Giovanni
I'll give it a try tomorrow.
Giovanni
-
- Posts: 417
- Joined: Tue Dec 21, 2010 10:19 am
- Location: Karlsruhe, Germany
- Been thanked: 1 time
- Contact:
Re: micro SD slots with no card detect signal
Hi Giovanni,
that would be great Thank you for looking into it, it's greatly appreciated.
@Tectu: That's call Thread hijacking! Anyway, get yourself a working debugger and don't complain until then RTOS development without a Debugger is just awful.
that would be great Thank you for looking into it, it's greatly appreciated.
@Tectu: That's call Thread hijacking! Anyway, get yourself a working debugger and don't complain until then RTOS development without a Debugger is just awful.
Re: micro SD slots with no card detect signal
mabl wrote:@Tectu: That's call Thread hijacking! Anyway, get yourself a working debugger and don't complain until then RTOS development without a Debugger is just awful.
I actually do have a debugger, I mostly just don't know how to use it the best way.
Also, I did just ask if someone has a similar problem, nothing else
~ Tectu
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: micro SD slots with no card detect signal
This will take some more time because the driver state machine changes entirely. You could simply make the detection function return TRUE and handle insertions outside the driver as a temporary workaround.
Giovanni
Giovanni
-
- Posts: 417
- Joined: Tue Dec 21, 2010 10:19 am
- Location: Karlsruhe, Germany
- Been thanked: 1 time
- Contact:
Re: micro SD slots with no card detect signal
Giovanni wrote:This will take some more time because the driver state machine changes entirely. You could simply make the detection function return TRUE and handle insertions outside the driver as a temporary workaround.
Giovanni
Hi Giovanni, that's what I'm currently doing. Also my SD cards are not removed during operation. So take your time changing the state machines. I was just looking for doing it the nice way since this is getting more and more important with the rise of Olimex boards.
-
- Posts: 417
- Joined: Tue Dec 21, 2010 10:19 am
- Location: Karlsruhe, Germany
- Been thanked: 1 time
- Contact:
Re: micro SD slots with no card detect signal
Hi Giovanni,
I've seen you made quite some changes - is this already considered "stable"?
I've seen you made quite some changes - is this already considered "stable"?
- Giovanni
- Site Admin
- Posts: 14444
- Joined: Wed May 27, 2009 8:48 am
- Location: Salerno, Italy
- Has thanked: 1074 times
- Been thanked: 921 times
- Contact:
Re: micro SD slots with no card detect signal
Hi, the driver changes are over, I am testing it right now in the STM32-E407 demo project (will have to adjust all other projects later), card detection works even if the D3 pin is shared with SDIO.
On the SPI interface there is a problem, the card detection is shared with CS which is a push-pull output, that prevents the detection of the card. There are two possible solutions to this:
1) Switch the CS in input mode, delay, read the value, switch to output mode. The problem is that the delay using R=1M and C=10pF is like 30uS, not possible in ISR context.
2) Make the CS an open drain output and rely on the 10K pull-up internal to the card. This could work but I haven't tested it yet.
Giovanni
On the SPI interface there is a problem, the card detection is shared with CS which is a push-pull output, that prevents the detection of the card. There are two possible solutions to this:
1) Switch the CS in input mode, delay, read the value, switch to output mode. The problem is that the delay using R=1M and C=10pF is like 30uS, not possible in ISR context.
2) Make the CS an open drain output and rely on the 10K pull-up internal to the card. This could work but I haven't tested it yet.
Giovanni
-
- Posts: 417
- Joined: Tue Dec 21, 2010 10:19 am
- Location: Karlsruhe, Germany
- Been thanked: 1 time
- Contact:
Re: micro SD slots with no card detect signal
Sounds great. I unfortunately do not have my boards with me over the weekend. But I'll sure test it within the next week. Thank you so much for taking all that time to make ChibiOS even greater!
Return to “Development and Feedback”
Who is online
Users browsing this forum: No registered users and 23 guests