| Author |
Message |
OA47
 Guru
 Joined: 11/04/2012 Location: AustraliaPosts: 1013 |
| Posted: 10:57pm 29 May 2020 |
Copy link to clipboard |
 Print this post |
|
I have a protocol converter program running on the ST ARM F4 module with MM.Ver=5.508 and I have an EVENT Log saving to the SD Card. I have found that the system has stalled on a couple of occasions when the SD card has been dislodged and when there was an ERROR writing to the SD card. As the EVENT LOG is not mission critical to the operation of the program but generated for fault diagnosis, I would like to continue operation of the program but display a message box warning of the situation.
I tried Geoff's example but found that the program still halts on SD errors.
Sub ChkSDOK Do On Error Skip Open CFN$ For Append As #4 If MM.Errno <> 0 Then Print "MM.ErrNo="MM.Errno If MsgBox("ERROR~Opening "+CFN$,"RETRY","CANCEL")=2 Then Exit Sub EndIf Loop While MM.Errno <> 0 End Sub
IIRC the MM.ErrNo when the SD Card is not seated correctly was 12.
Any help appreciated. Graeme |
| |
Chopperp
 Guru
 Joined: 03/01/2018 Location: AustraliaPosts: 1106 |
| Posted: 07:07am 30 May 2020 |
Copy link to clipboard |
 Print this post |
|
Hi OA47
I do this to check if the card is present or not in the F4. Uses mm.info$
sub Data_Save IF mm.info$(sdcard) <> "Ready" then 'check if SD Card is present print "SD Card NOT present " exit sub else print "SD Card Present ", endif . . .
Edit.
I also have this in the main loop.
IF mm.info$(sdcard) = "Ready" then text 200, 450, "SD CRD OK", LT, 1, 2, rgb(green), cBGnd ELSE text 200, 450, "SD NOT OK", LT, 4, 1, rgb(red), cBGnd Ctr = 0 'Enable data save when re-inserted endif
Brian Edited 2020-05-30 17:14 by Chopperp ChopperP |
| |
OA47
 Guru
 Joined: 11/04/2012 Location: AustraliaPosts: 1013 |
| Posted: 07:41am 30 May 2020 |
Copy link to clipboard |
 Print this post |
|
Thanks Chopperp, I will give your code a go. I have not latched onto MM.Info$(sdcard) so as always there is something else to learn about these amazing devices. Graeme |
| |
Chopperp
 Guru
 Joined: 03/01/2018 Location: AustraliaPosts: 1106 |
| Posted: 07:57am 30 May 2020 |
Copy link to clipboard |
 Print this post |
|
I stumbled across it doing what you are doing.
Thinking about it, I probably should just set a flag in the main loop & check the flag status just prior to using the SD card in Data_Save.
Brian ChopperP |
| |
OA47
 Guru
 Joined: 11/04/2012 Location: AustraliaPosts: 1013 |
| Posted: 09:24am 07 Jul 2020 |
Copy link to clipboard |
 Print this post |
|
More help needed with the SD card on the F4. The random failure of the Sd card has become frequent enough to be annoying. I have tried new cards, delays in program around the SD card code and none have really improved the situation. I am using PE2, PE3, PE4, PE5, PE6, PC13, PC0, PC1, PC2, PC3, PA0, PA1, PA2, PA3, PC4, PB0 pins for monitoring and I cannot see any conflicts with the Sd card pins. Each of the pins are held high by an external 10K resistor and are pulled low by opto-coupler outputs. What I have found is that if I disconnect the ribbon cable to the opto outputs and pullups the program always boots without the "SD CARD not present error" and I can re-connect the cable while the program is running and I dont get any further errors until a re-boot. I have ordered replacement F4 boards a couple of months ago to verify that there is not a fault on the board I am using but they are still to arrive. At the moment I have run out of ideas and would like any comment from fellow shedders.
OA47 |
| |
matherp Guru
 Joined: 11/12/2012 Location: United KingdomPosts: 10578 |
| Posted: 09:34am 07 Jul 2020 |
Copy link to clipboard |
 Print this post |
|
SD comms using SDIO seems much more susceptible to noise than SPI which is why I've stuck with SPI on the CMM2 even though it is slower. The pullups on the board are probably 10K which is higher than ST recommend. You could try replacing these with 47K. I haven't got the circuit diagram to hand but also make sure there isn't a pullup on the clock line |
| |
OA47
 Guru
 Joined: 11/04/2012 Location: AustraliaPosts: 1013 |
| Posted: 10:01am 07 Jul 2020 |
Copy link to clipboard |
 Print this post |
|
According to the CCt diagram all pullups on the SD card are 10K and there is one shown on the CLk line.

OA47 |
| |
matherp Guru
 Joined: 11/12/2012 Location: United KingdomPosts: 10578 |
| Posted: 10:13am 07 Jul 2020 |
Copy link to clipboard |
 Print this post |
|
Start by removing the pullup on the clock line and see if that helps |
| |
OA47
 Guru
 Joined: 11/04/2012 Location: AustraliaPosts: 1013 |
| Posted: 09:28pm 07 Jul 2020 |
Copy link to clipboard |
 Print this post |
|
Thanks Peter. Will do. OA47 |
| |
OA47
 Guru
 Joined: 11/04/2012 Location: AustraliaPosts: 1013 |
| Posted: 02:48am 09 Jul 2020 |
Copy link to clipboard |
 Print this post |
|
Peter you were right on the money. Lifted R27 (SDIO SCK Pullup 10K) and have not been able to get the error to appear.
Thank you, Thank you, Thank you (Now I might have more time to have a play with the CMM2) |
| |