![]() |
Forum Index : Microcontroller and PC projects : V4.7 : MX170 SDCard FAT32 Driver
![]() ![]() |
|||||
Author | Message | ||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
Oh :( John [best hope Geoff doesn't decide to do anything similar!] |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2642 |
Feedback on The Back Shed_ V4.7 _ MX170 SDCard FAT32 Driver Test Harness for CFunction FAT32 FileSystem driver (c) Peter Carnegie 2015 Ver 1.6 Has anyone had problems with above? The issue I've had is the SD Card (FAT32) died when this program began wtiting to it. It isn't just a problem with the File System, both Format and Fdisk respond with "Insert Disk" and go no further. Linux doesn't see see card at all. Have been using this card for data logging with a Mictomite Plus LCD Backpack for about 6 months without problem, but now want to use the MM+ for another project. The idea is to adapt this program (V4.7 _ MX170 SDCard FAT32 Driver) to continue the logging on a cheaper Mictomite 2. The first step was to run this program unmodified, and that's as far as I have got. Has anyone else had problems? Before I try another SD card I'd like to know what I have done wrong. Do different brands of SD card behave differently? Hardware:- PIC32MX170F256B-50I/SP (28 pin) (purchased from Silicon Chip) Catalex MicroSD Card Adapter v1.0 11/01/2013 catalex.taobao.com (purchased from Silicon Chip) SD Card - Samsung MicroSD-HC Class C2 8GB Connected together on breadboard as per comments in program. (Vcc = 3.3V,pins 13,28. Gnd,pins 8,19,27. Core reg. cap. 10uF ceramic // 47uF Tant pin 20) Firmware/Software:- MM2 Micromite_V5.04.08.hex Test Harness for CFunction FAT32 FileSystem driver (c) Peter Carnegie 2015 Ver 1.6 (downloaded from The Back Shed_ V4.7 _ MX170 SDCard FAT32 Driver) logfile.csv (made using 'dd if=/dev/zero of=/dev/sdd1/logfile.csv bs=1M count=10' in linux console) Captured from Tera Term:- AUTOSAVE OPTION EXPLICIT OPTION DEFAULT NONE CPU 48 CONST VER!=1.6 'Using Catalex micro SDCard breakout board 'PIC32MX170 28 Pin wiring 'Pin 2 Chip Select can be any digital output pin 'Pin 3 MOSI 'Pin 14 MISO 'Pin 25 SCLK PRINT "Test Harness for CFunction FAT32 FileSystem driver (c) Peter Carnegie 2015 Ver";Ver! PRINT "Simulates use of SDCard for Logging data" ( Rest of program here ) 1060000f 24100096 2404000a 1444000e 2410ffff 5460000d 2411ffff 3c029d00 8c42008c 8c420000 8c420028 ae420000 ae400004 00008021 10000004 00008821 10000002 00008821 2411ffff 02001021 02201821 8fbf002c 8fb40028 8fb30024 8fb20020 8fb1001c 8fb00018 03e00008 27bd0030 41909a80 808f418e 49454545 8f8e4949 4f929290 55554f99 9b9a9959 9f9e9d9c 554f4941 a7a6a5a5 abaaa9a8 afae21ac b3b2b1b0 b7b6b5b4 bbbab9b8 bfbebdbc c3c2c1c0 c7c6c5c4 cbcac9c8 cfcecdcc d3d2d1d0 d7d6d5d4 dbdad9d8 dfdedddc e3e2e1e0 e7e6e5e4 ebeae9e8 efeeedec f3f2f1f0 f7f6f5f4 fbfaf9f8 fffefdfc END CFUNCTION 'MIPS32 M4K ' '***************************************************************************** Saved 29912 bytes > RUN Test Harness for CFunction FAT32 FileSystem driver (c) Peter Carnegie 2015 Ver 1.6 Simulates use of SDCard for Logging data CFunction Driver Version= 1.5 Initialise the Driver Initialise the disk Error : Failed to Initialise Disk. Please re-insert media and try again. Error Code: 1 <<<< MM Reset here > Micromite MKII MMBasic Ver 5.04.08 Copyright 2011-2017 Geoff Graham > RUN Test Harness for CFunction FAT32 FileSystem driver (c) Peter Carnegie 2015 Ver 1.6 Simulates use of SDCard for Logging data CFunction Driver Version= 1.5 Initialise the Driver Initialise the disk Mount the disk Open File /logfile.csv Get Length of file /logfile.csv File /logfile.csv is 10485760 bytes in size Get Number of logging records already in file Number of Existing Log Records : 0 Write Updated Number of Records to disk <<<< This is where I think the SD card died. Flush data to secure it Error : Flush to disk failed. Error Code: 1 Create Header entry if it doesn't exist Error : Failed to seek to position 512. Error Code: 4 Error : Failed to Read file. Error Code: 4 Creating File Header Seek to 512 Error : Failed to seek to position 512. Error Code: 4 Error : Failed to write to file. Error Code: 4 Error : Flush to disk failed. Error Code: 4 Write a simulated Temperature entry to the Log file Error : Failed to seek to position 1536. Error Code: 4 Write New Log record out :"01-01-2000","00:00:12","20.69" Error : Failed to write to file. Error Code: 4 Flush log record to secure it Error : Failed to Flush data to disk. Error Code:. Error Code: 4 Read and display our logging file Error : Failed to seek to position 0. Error Code: 4 Error : Failed to Read File . Error Code: 4 [168] NumRecords%=Val(Mid$(Buffer$,1,Instr(Buffer$,".0")-1)) Error: -1 is invalid (valid is 0 to 255) > RUN Test Harness for CFunction FAT32 FileSystem driver (c) Peter Carnegie 2015 Ver 1.6 Simulates use of SDCard for Logging data CFunction Driver Version= 1.5 Initialise the Driver Error : Failed to Initialise DRIVER. Please Power Cycle system. Error Code: 255 <<<< MM Reset here > Micromite MKII MMBasic Ver 5.04.08 Copyright 2011-2017 Geoff Graham > RUN Test Harness for CFunction FAT32 FileSystem driver (c) Peter Carnegie 2015 Ver 1.6 Simulates use of SDCard for Logging data CFunction Driver Version= 1.5 Initialise the Driver Initialise the disk Error : Failed to Initialise Disk. Please re-insert media and try again. Error Code: 1 |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Hello. ![]() Welcome aboard. Peter Carnegie is no longer an active developer of MM code, so using any of his older routines could be a problem for you, as there is zero support available for those routines now, and no source to look at. ![]() Your best bet might be to use the SD card driver that matherp wrote as a replacement. It is not as fancy, but it does the job if you desperately need SD card ability on the 170 series MM chips. See this link as a starting point. Smoke makes things work. When the smoke gets out, it stops! |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2642 |
Thanks for the advice. I'll have a look at that or perhaps a serial EEPROM. |
||||
Grogster![]() Admin Group ![]() Joined: 31/12/2012 Location: New ZealandPosts: 9610 |
Geoff wrote a lovely little Cfunction for talking to 11AA160 or 11AA161 one-wire EEPROM chips. They are very cheap(about 30c each!), and have up to 1,000,000 write cycles. Have a look at this thread. They currently are my go-to EEPROM device even over and above the standard I2C ones. EDIT: If you DO decide to play with these devices, make sure you use the latest Cfunction from page three of that thread. The first one had a couple of bugs that Geoff squished during that thread. Smoke makes things work. When the smoke gets out, it stops! |
||||
Geoffg![]() Guru ![]() Joined: 06/06/2011 Location: AustraliaPosts: 3292 |
Also the latest working version is included in the Micromite firmware zip file. Geoff Graham - http://geoffg.net |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
Not even in system logs (e.g. via dmesg)? Even with a corrupted file system it should be seen there (assuming a working SD slot and if needed SD to uSD adapter). John |
||||
SteveA Regular Member ![]() Joined: 10/03/2017 Location: United KingdomPosts: 48 |
Take a look here http://www.thebackshed.com/forum/forum_posts.asp?TID=8492&KW=data+logger&PN=1&TPN=1 I've just bought 5 8MB ones for one and a half UK pounds! I used a couple to upgrade ESP01's and I've just finished mounting another on a 8 pin dil socket so I can have a play with a MM. |
||||
phil99![]() Guru ![]() Joined: 11/02/2018 Location: AustraliaPosts: 2642 |
Not even in system logs (e.g. via dmesg)? Thanks for the tip. dmesg showed nothing so I put a good card in the reader which created /dev/sdf, ran dmesg again to see what changed, then again after replacing it with the damaged card. this is what came out:- Output from dmesg: "sdf: detected capacity change from 1015808000 to 0" Then ran GParted: "Error opening /dev/sdf: No medium found" fdisk /dev/sdf returned nothing at all. Since all the program did was write some data, I imagine it has done so in the wrong place - over data needed by the OS. Unless someone knows how to restore that the uSD card is as good as dead. |
||||
JohnS Guru ![]() Joined: 18/11/2011 Location: United KingdomPosts: 4044 |
That's a dead card, not one where the OS structures were overwritten. (In that latter case, dmesg would show the card and fdisk etc would show its size and other info. You would then be able to reformat/partition it.) John |
||||
G8JCF![]() Guru ![]() Joined: 15/05/2014 Location: United KingdomPosts: 676 |
My goodness, what a blast from the past ! Brought back some memories :) Should I update this driver or has time passed this by? Take care Peter The only Konstant is Change |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |