Gentlemen,
I'm running ChibiOS 2.6,
I've got an SD card connected to the STM32F103RG via SPI2 and I was using the FatFS Demo provided in ChibiStudio.
With a 8GB Class 4 transcend card the system works without any issue after a software reset. So it initializes and everything and resumes operation.
Recently we got a pack of 4GB Class4 cards. These cards do not get initialized after a software reset or after pressing the reset button.
InsertHandler exits after mmcConnect
But if i remove power and put it back in, it initializes fine. This issue is only for Reset (button press) or software reset.
I am guessing the card is still active since it's last power on, is there a way to de-init or force init the card?
I tried adding delays in various places but no luck.
This is not a big deal if i use the 8GB cards, but I know these cards won't be around so we need to get the system working with any sort of cards, so this is an important issue.
Any insights?
ST32F103RG FatFS Not Initializing on software reset
Moderators: RoccoMarco, barthess
- 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: ST32F103RG FatFS Not Initializing on software reset
Hi,
It looks like the card is stuck in an initialized state because it does not get the reset like the CPU. I am not sure how this should be fixed, may be sending some kind of "init" command to the card before the normal connection procedure.
You should get the card documentation and see the recommended initialization procedure.
Giovanni
It looks like the card is stuck in an initialized state because it does not get the reset like the CPU. I am not sure how this should be fixed, may be sending some kind of "init" command to the card before the normal connection procedure.
You should get the card documentation and see the recommended initialization procedure.
Giovanni
Re: ST32F103RG FatFS Not Initializing on software reset
Thanks Sir,
Well so i was following How to Use MMC/SDC from elmchan http://elm-chan.org/docs/mmc/mmc_e.html
Following the 1st step i tried
But obviously that doesn't work. Any advice on how i can do the above steps ( 70 clocks with DI and CS high) ?
I am guessing I am close.
Well so i was following How to Use MMC/SDC from elmchan http://elm-chan.org/docs/mmc/mmc_e.html
Following the 1st step i tried
Code: Select all
palSetPadMode(IOPORT2, 12, PAL_MODE_OUTPUT_PUSHPULL);
palSetPadMode(IOPORT2, 13, PAL_MODE_OUTPUT_PUSHPULL); //CLK
palSetPadMode(IOPORT2, 15, PAL_MODE_OUTPUT_PUSHPULL);
palSetPad(IOPORT2, 12); //STMNS
palSetPad(IOPORT2, 15); //STM MOSI
chSysLockFromIsr();
int x=0;
for(x=0;x<500;x++)
{
palTogglePad(IOPORT2,13);
chThdSleepMicroseconds(100);
}
chSysUnlockFromIsr();
But obviously that doesn't work. Any advice on how i can do the above steps ( 70 clocks with DI and CS high) ?
I am guessing I am close.
- 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: ST32F103RG FatFS Not Initializing on software reset
Note that chThdSleepMicroseconds(7) does not actually sleep 7 microseconds, the real resolution is dictated by the system tick.
Anyway, the generation of clock pulses is already done by the driver.
Giovanni
Anyway, the generation of clock pulses is already done by the driver.
Giovanni
Re: ST32F103RG FatFS Not Initializing on software reset
send_command_R1 returns 1 from Poweroff to start.
On restart the same function returns FF(255). Could it mean it needs more time? Or the sd card is not willing to get resetted?
spiIgnore(mmcp->config->spip, 100); is responsible for the clocks yes?
On restart the same function returns FF(255). Could it mean it needs more time? Or the sd card is not willing to get resetted?
spiIgnore(mmcp->config->spip, 100); is responsible for the clocks yes?
- 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: ST32F103RG FatFS Not Initializing on software reset
spiIgnore() generates the clock pulses and puts the card in SPI mode, after the reset the card should already be in SPI mode.
Giovanni
Giovanni
Re: ST32F103RG FatFS Not Initializing on software reset
Hi!
I've the same problem when a power fault pulse does reset microcontroller but doesn't reset the 4GB SD. As described in a precedent post, if I instead use a 32 GB SD, the bug doesn't occur. I've solved this problem inserting a circuit that removes power to SD in initializing phase of the microcontroller. But there is anyone who knows because this happens?
Regards
Pietro
I've the same problem when a power fault pulse does reset microcontroller but doesn't reset the 4GB SD. As described in a precedent post, if I instead use a 32 GB SD, the bug doesn't occur. I've solved this problem inserting a circuit that removes power to SD in initializing phase of the microcontroller. But there is anyone who knows because this happens?
Regards
Pietro
Who is online
Users browsing this forum: No registered users and 13 guests