Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PIC32 PINGUIONO's and SD
03-05-2012, 12:17 PM, (This post was last modified: 03-05-2012, 12:57 PM by mf01.)
#11
RE: PIC32 PINGUIONO's and SD
Hi Dale,

There is a lot you can do even without CDC, but it does help. Please find attached an example program. It is based on the code in your last post (post #10) in this thread with a few changes.

I have changed the reference to the yellow LED from pin 10 to YELLOWLED. This is defined for the PIC32 Pinguino OTG and the PIC32 Pinguino Micro in const.h so this should mean that it works on both boards (although I only have a PIC32 Pinguino OTG so I have not tested it on the Micro but see also below).

What I have not been able to check is which IDE Pin is the correct one for SD card select (SD slot pin 2) for the PIC32 Pinguino Micro. I know it is IDE Pin 8 for the PIC32 Pinguino OTG - but it might be worth confirming the correct value for the Micro it may not be IDE Pin 8! although this may have been dealt with in by the changes in r350 to sdmmc.h.

I have included several more LED on/offs so that in normal operation the yellow LED should flash once when the program starts and then three times per logging cycle. Once before data is written, once after data is written and once after the read cycle. As the data file gets longer the pause between the second and third flashs of the yellow LED will increase (although this may not be noticeable initially). On the OTG board the green LED will also flash each time the SD card is accessed but on my OTG board the this is partially masked by the much brighter yellow LED. These work for the PIC32 Pinguino OTG board but will conflict with the definitions in sdmmc.h. I suggest you remark out the appropriate lines thus:-
Code:
// #define READ_LED            10  // Yellow Led
// #define WRITE_LED            10  // Yellow Led
sdmmc.c skips the commands using READ_LED and WRITE_LED if they are not defined (they are not defined for the PIC32 Pinguino OTG board) so this change will make the two boards behave more similarly.

I have re-instated the CDC.print lines so that I could check that the program was functioning without have to keep rebooting and looking at the card. I have checked that these lines do not stop the program from running. What I have noticed is that when the program is running and the board is connected to external power, i.e. not powered from a computer USB port , there is an sometimes an additional delay before the read cycle.

As I write this it has got up to 7155 bytes of data, at 5 bytes per cycle and is still going strong ;-)

I have increased the delay between loops to 5 seconds - just to make sure that I could depower/restart the board in a "dead period" when the program was not attempting to access the SD card. 1 second struck me as being a bit short and I have seen problems in the past when a SD card has been interrupted mid-cycle. I luckily was able to recover the SD card by re-formatting it in a separate card reader but until I did so I could not access it in the Pinguino board.

I have also change b to type u32 - this is not relevant to your code, but is to the read code as I realised the a 16 bit variable was probably for too short for the possible file size.

I also change one of the CDC.println's to a CDC.printf as it was giving anomalous output - again not relevant to your code but worth noting if you try expanding your code to include checking via CDC.

Regards.


Attached Files
.pde   SimplifiedLoggerExample03May2012.pde (Size: 3.01 KB / Downloads: 26)
Board = PIC32-Pinguino-OTG Rev C
OS = Linux Unbuntu 11.10 till 26 Apr 2012
OS = Linux Unbuntu 12:04 from 27 Apr 2012
Reply
03-05-2012, 04:35 PM, (This post was last modified: 03-05-2012, 04:35 PM by KiloOne.)
#12
RE: PIC32 PINGUIONO's and SD
Thanks mf, I know how much time you have been sending my way and I do appreciate it.

I think I have some gremlins in my computer that are laughing at me.

First, I am using Patriot 2gb cards which supposedly behave nicely.

Thanks for adding more smoke signals. The version of sdmmc.h that I have defines the READ_LED.... inside a MICRO specific condition so I did not rem them out.

I started to get really inconsistent results which I tracked down after a long time to a very position sensitive SD card holder in the OTG. The SD must be seated perfectly, tuner cleaner helped.

I made three changes so I could sort out the blinking a little better with my slow brain. I changed the delay at the end of setup to 2000, I changed the LED logic inside the if (!res) condition so that the LED only flashes once but gives the same info to me and I made the yellow flashes 1 second long:
Code:
    #define B_SIZE 32            // Size of read buffer - arbitrary length,
                                    // try changing it to improve efficiency
    UINT            i, l, btw, bw, br;
    u32            b;
    char            filename[]    = "datalog9.csv";    
    FIL            fil;                            // File object
    FRESULT        res,    rc;
    DWORD        file_size;
    char            read_buff[B_SIZE];

void setup() {
    pinMode(YELLOWLED, OUTPUT);            // Set YELLOWLED pin for output
    digitalWrite(YELLOWLED, HIGH);         // Turn YELLOWLED On
    delay(200);
    digitalWrite(YELLOWLED, LOW);         // Turn YELLOWLED Off
    delay(2000);
}

void loop()  {
    char    buffer[40]    = "1234,";        // arbitary value of 40 for length of character array
    btw = strlen(buffer);                //    number of Bytes To be Written
    SD.mount(8);                         //    Allocate file structure
    /*    Open existing file or new file if file does not already exist */
    res = SD.open(&fil, filename, FA_OPEN_ALWAYS | FA_READ | FA_WRITE);
    if (!res){
        digitalWrite(YELLOWLED, HIGH);         // Turn YELLOWLED On
        delay(1000);
        //digitalWrite(YELLOWLED, LOW);         // Turn YELLOWLED Off
        //delay(200);
        file_size = fil.fsize;                        // Get existing file size
        SD.seek(&fil,file_size);                    // Set R/W pointer to end of file
        /*    Write data to file */
        rc = SD.write(&fil, buffer, btw, &bw);        // write new data to file
        SD.flush(&fil);                                // flush any data in cache to file
                                                    // to avoid data loss from loss of power etc
        SD.close(&fil);        //    Included for safety to ensure file properly closed
        SD.unmount();            //    in case user removes card instead of proceeding.
        //digitalWrite(YELLOWLED, HIGH);         // Turn YELLOWLED On
        //delay(200);
        digitalWrite(YELLOWLED, LOW);         // Turn YELLOWLED Off
        delay(500);
   }

    /*    Re-open existing data file - effectively resets R/W pointer to start of file */
    SD.mount(8);                             //    Allocate file structure
    res = SD.open(&fil, filename, FA_OPEN_EXISTING | FA_READ | FA_WRITE);

    if (!res){

        /*    Display data file on terminal including new data added above */
        CDC.println("\n\r*** File %s contents ***", filename);
        b = 0;                                 // byte counter
        l = 0;                                 // line counter
        do {
            rc = SD.read(&fil, read_buff, B_SIZE, &br);    
                                                    // Read a chunk of file
            b = b + br;                        // update byte counter
            for(i = 0; i < br; i++){
                CDC.printf("%c", read_buff[i]);
                if (read_buff[i] == '\n'){
                    CDC.printf("\r");
                    l++;                        // increment line counter
                }
            }
        } while(br == B_SIZE);            // while buffer is full
        SD.close(&fil);        //    Included for safety to ensure file properly closed
        SD.unmount();            //    in case user removes card instead of proceeding.
        CDC.println("*** End of file ***  ");
        CDC.printf("*** %u lines, %u bytes read.\r\n", l, b);
        digitalWrite(YELLOWLED, HIGH);         // Turn YELLOWLED On
        delay(1000);
        digitalWrite(YELLOWLED, LOW);         // Turn YELLOWLED Off
        delay(200);
    }

    delay(5000);
}

My results on external power only are (CAPS are 1 second on's and lowercase are short blips):

OTG:
1. yellow - green - YELLOW - green and then no more => file created, one record ADDED each reset

MICRO
1. NOTHING

On OTG I decided that the culprit being getting stuck in the read loop so I took the whole mount to unmount read section out and the OTG codes began repeatedly adding a record every 5 secs, Big Grin for small steps. Why is my OTG different that yours?

On the MICRO still nothing and no ideas.

Hopefully I can get CDC working at some point here but even that won't help if the first line of code wont execute.

Also, I hope to be running full blown x.3 soon to give that a try.

Dale
PIC32-Pinguino-OTG Rev C and PIC32-PINGUINO-MICRO rev.B
Win XP SP3
r381 x.3 Big Grin
AND spi.c {} error fixed
AND sdmmc.c pin error fixed
AND diskio.c fixed, MICRO can't use the RTCC
AND analog.c fixed for MICRO
Reply
04-05-2012, 03:20 AM, (This post was last modified: 04-05-2012, 03:40 AM by KiloOne.)
#13
RE: PIC32 PINGUIONO's and SD
Mark,

I have been tracking down more of your leads.

I think I have found a Pin error but I fixed it and it has not helped yet in my quest to get SD working on my MICRO as there may still be multiple problems.

Anyway here is what I think is the error. The current x.3 rev 350 of sdmmc.h has this condition in it:
Code:
#ifdef PIC32_PINGUINO_MICRO
        #define SDCS                            41      // RB13/MMC_#SS Card Select output
        #define READ_LED                        10  // Yellow Led
        #define WRITE_LED                       10  // Yellow Led
#endi

I do believe that MMX_#SS goes to RB13 according to the MICRO rev. B schematic.

However, the current x.3 rev r350 of digitalw.c has this condition:
Code:
#ifdef PIC32_PINGUINO_MICRO


const u32 portmask[]= {  pB,  pB,  pB,  pB,  pB,  pB,  pB,  pB, // 0-7
                        pB,  pB,  pD,  pD,  pD,  pD,  pD,  pD, // 8-15
                        pB,  pD,  pD,  pD,  pG,  pF,  pE,  pE, // 16-23
                        pE,  pE,  pE,  pE,  pE,  pE,  pC,  pC, // 24-31
                        pG,  pF,  pF,  pD,  pD,  pG,  pG,  pF, // 32-39
                        pB,  pD };                            // 40-41  P41 strapped with P13


const u32 pinmask[]=  {  _1,  _2,  _3,  _4,  _8,  _9, _10, _11, // 0-7
                        _12, _14,  _1,  _2,  _3,  _4,  _5,  _6, // 8-15
                         _0,  _7,  _8, _11,  _9,  _1,  _7,  _6, // 16-23
                         _5,  _4,  _3,  _2,  _1,  _0, _13, _14, // 24-31
                         _6,  _4,  _5,  _9, _10,  _8,  _7,  _0, // 32-39
                         _13,  _0 };                            // 40-41  P41 strapped with P13
#endif

So, according to digitalw.c the MICRO RB13 pin is pin 40, NOT 41.

Am I interpreting this correctly?

Thanks,
Dale

ps is it just me or is the font used in these code windows not a true fixed width font Confused
PIC32-Pinguino-OTG Rev C and PIC32-PINGUINO-MICRO rev.B
Win XP SP3
r381 x.3 Big Grin
AND spi.c {} error fixed
AND sdmmc.c pin error fixed
AND diskio.c fixed, MICRO can't use the RTCC
AND analog.c fixed for MICRO
Reply
04-05-2012, 09:53 AM,
#14
RE: PIC32 PINGUIONO's and SD
Hi Dale,

I have looked at the PIC32 Pinguino Micro Schematic (Rev_B) and :-
  • the line going to SD/MMC Pin 2 (CD/DAT3/CS) is labelled MMC_#SS
  • the line going to IC Pin 28 (TDI/AN13/PMA10/RB13) is also labelled MMC_#SS
Therefore I would expect SDCS to be associated with Port/Register RB13.
Also
  • the line going to IC Pin 46 (OC1/INT0/RD0) is labelled BUT
  • it it linked via Jumper BUT_J to CON2-3 and IC Pin 52
  • the line going to IC Pin 52 (OC5/IC5/PMWR/CN13/RD4) is connected directly to CON2-3
So there is no indication that IC Pin 46 (RD0) is connected to any of the SD/MMC connections.

Looking at the X.3 r350 digitalw.c file, then I would also agree that IDE P40 = RB13 and IDE P41 = RD0.

I have also checked the past changes to these files and the changes to sdmmc.h occurred around X.3 r317/r318 whereas the inclusion of P41 for the Micro did not come till X.3 r324.

Therefore it does look like for the PIC32 Pinguino Micro SDCS although the comment in the sdmmc.h file is correct the IDE Pin number should be 40 not 41.

For the sake of completeness I would suggest checking the physical connection between IC Pin 28 and SD/MMC Pin 2.

Also for the sake on completeness I also noticed that LED1 (the green LED) is connected to the SCK line, so LED1 should not be addressed directly when the SD card functions are being used. This is the same as on the PIC32 Pinguino OTG board (where it is also connected to D13/IDE P13).

I would say that it is definitely worth trying changing the line in sdmmc.h to read :-
Code:
#define SDCS                            40      // RB13/MMC_#SS Card Select output
and seeing how the PIC32 Pinguino Micro responds.

Regards
Board = PIC32-Pinguino-OTG Rev C
OS = Linux Unbuntu 11.10 till 26 Apr 2012
OS = Linux Unbuntu 12:04 from 27 Apr 2012
Reply
04-05-2012, 03:35 PM,
#15
RE: PIC32 PINGUIONO's and SD
Looks very promising! Thanks guys.

John
Reply
04-05-2012, 06:49 PM, (This post was last modified: 05-05-2012, 12:48 AM by KiloOne.)
#16
RE: PIC32 PINGUIONO's and SD
Mark

I can confirm that I physically probed my MICRO and there is continuity between IC Pin 28 and SD/MMC Pin 2.

As per:
   
and:
   

And for the sake of my eyes I have done some bit manipulation of the PIC32-PINGUINO-MICRO Rev. B schematic bitmap image:
   

Dale


Now onto another set of issues that I am trying to document.

In order for me to compile your program simplifiedLoggerExample03May2012.pde for the OTG using in my x.2 setup after copying the folder Pinguino X.3 v3.63\p32\include\pinguino\libraries\sd to my x.2 structure, I had to make a change in the sdmmc.c file to let SCDS get defined for the OTG.

After I did this, the uploaded program does this on the OTG:

yellow, green, yellow, yellow, green and then freezes. The file was created and one record added.

Rather than continue trying to describe my currently unsuccessful attempts to debug this OTG problem I will move on to debugging my board of interest, the MICRO.

I applied the Pin 41 to 40 correction in sdmmc.h and I remmed out the READ_LED and WRITE_LED defs in the MICRO section of sdmmc.h. I then compiled simplifiedLoggerExample03May2012.pde for the MICRO and when run, it does not seem to even initiate the first line in the setup function(no Yellow or green LED ever comes on, no file made).

Not sure if this is relevant but there are a number of warnings in the stdout at this stage:
Code:
if exist C:\Pinguino32X.2\source\main32.o @del C:\Pinguino32X.2\source\main32.o
if exist C:\Pinguino32X.2\source\main32.elf @del C:\Pinguino32X.2\source\main32.elf
if exist C:\Pinguino32X.2\source\main32.hex @del C:\Pinguino32X.2\source\main32.hex
if exist C:\Pinguino32X.2\p32\obj\non-free\processor.o @del C:\Pinguino32X.2\p32\obj\non-free\processor.o
        1 file(s) copied.
C:\Pinguino32X.2\win32\p32\bin\mips-gcc.exe -EL -O3 -ffunction-sections -fdata-sections -Wl,--gc-sections -march=24kc -msoft-float -Wl,-LC:\Pinguino32X.2\p32\obj\non-free -Wl,--defsym,_min_heap_size=16384 -Wl,-Map=C:\Pinguino32X.2\source\output.map -D __PIC32MX__ -D __32MX440F256H__ -D PIC32_PINGUINO_MICRO -TC:\Pinguino32X.2\p32\lkr\PIC32_PINGUINO_MICRO\procdefs.ld -TC:\Pinguino32X.2\p32\lkr\PIC32_PINGUINO_MICRO\elf32pic32mx.x -LC:\Pinguino32X.2\p32\obj\non-free\usb -lm -lgcc -lc -fdollars-in-identifiers -IC:\Pinguino32X.2\p32\include\non-free -IC:\Pinguino32X.2\p32\include\pinguino\core -IC:\Pinguino32X.2\p32\include\pinguino\libraries -IC:\Pinguino32X.2\p32\lkr\PIC32_PINGUINO_MICRO -IC:\Pinguino32X.2\examples\10.Libraries\SD -IC:\Pinguino32X.2\p32\obj\non-free -o C:\Pinguino32X.2\source\main32.elf C:\Pinguino32X.2\source\main32.c \
        C:\Pinguino32X.2\p32\obj\non-free\crt0.S \
        C:\Pinguino32X.2\p32\obj\non-free\processor.o \
        C:\Pinguino32X.2\p32\obj\non-free\usb\libcdc.a \
        C:\Pinguino32X.2\p32\obj\non-free\usb\libadb.a \
        C:\Pinguino32X.2\p32\lkr\PIC32_PINGUINO_MICRO\ISRwrapper.S \
        C:\Pinguino32X.2\p32\include\non-free\p32xxxx.h \
        -lm -lgcc -lc
In file included from C:\Pinguino32X.2\source\/define.h:10:0,
                 from C:\Pinguino32X.2\source\main32.c:29:
C:\Pinguino32X.2\p32\include\pinguino\core/__cdc.c: In function 'CDCwrite':
C:\Pinguino32X.2\p32\include\pinguino\core/__cdc.c:211:2: warning: passing argument 1 of 'CDCputs' makes pointer from integer without a cast
C:\Pinguino32X.2\p32\include\pinguino\core/__cdc.c:164:6: note: expected 'char *' but argument is of type 'char'
C:\Pinguino32X.2\p32\include\pinguino\core/__cdc.c: In function 'CDCprint':
C:\Pinguino32X.2\p32\include\pinguino\core/__cdc.c:250:20: warning: cast from pointer to integer of different size
C:\Pinguino32X.2\p32\include\pinguino\core/__cdc.c: In function 'CDCgetstring':
C:\Pinguino32X.2\p32\include\pinguino\core/__cdc.c:294:2: warning: return makes integer from pointer without a cast
In file included from C:\Pinguino32X.2\source\main32.c:32:0:
C:\Pinguino32X.2\p32\include\pinguino\core/newlib.c: At top level:
C:\Pinguino32X.2\p32\include\pinguino\core/newlib.c:91:28: warning: 'struct stat' declared inside parameter list
C:\Pinguino32X.2\p32\include\pinguino\core/newlib.c:91:28: warning: its scope is only this definition or declaration, which is probably not what you want
C:\Pinguino32X.2\win32\p32\bin\mips-objcopy.exe -O ihex C:\Pinguino32X.2\source\main32.elf C:\Pinguino32X.2\source\main32.hex
copy C:\Pinguino32X.2\source\main32.hex C:\Pinguino32X.2\source\main32tmp.hex  
        1 file(s) copied.

Paring your code down to a minumum code to get the yellow LED to come on from the setup function code and yet still use a routine from SD usage, I tried this. (I had to include const.h so that YELLOWLED got defined):
Code:
#include <const.h>

void setup() {
    pinMode(YELLOWLED, OUTPUT);            // Set YELLOWLED pin for output
    digitalWrite(YELLOWLED, HIGH);         // Turn YELLOWLED On
    SD.mount(8);                         //    Allocate file structure
}

void loop()  {
}

STAGE 3 => This would not compile for MICRO here is stdout:
Code:
if exist C:\Pinguino32X.2\source\main32.o @del C:\Pinguino32X.2\source\main32.o
if exist C:\Pinguino32X.2\source\main32.elf @del C:\Pinguino32X.2\source\main32.elf
if exist C:\Pinguino32X.2\source\main32.hex @del C:\Pinguino32X.2\source\main32.hex
if exist C:\Pinguino32X.2\p32\obj\non-free\processor.o @del C:\Pinguino32X.2\p32\obj\non-free\processor.o
        1 file(s) copied.
C:\Pinguino32X.2\win32\p32\bin\mips-gcc.exe -EL -O3 -ffunction-sections -fdata-sections -Wl,--gc-sections -march=24kc -msoft-float -Wl,-LC:\Pinguino32X.2\p32\obj\non-free -Wl,--defsym,_min_heap_size=16384 -Wl,-Map=C:\Pinguino32X.2\source\output.map -D __PIC32MX__ -D __32MX440F256H__ -D PIC32_PINGUINO_MICRO -TC:\Pinguino32X.2\p32\lkr\PIC32_PINGUINO_MICRO\procdefs.ld -TC:\Pinguino32X.2\p32\lkr\PIC32_PINGUINO_MICRO\elf32pic32mx.x -LC:\Pinguino32X.2\p32\obj\non-free\usb -lm -lgcc -lc -fdollars-in-identifiers -IC:\Pinguino32X.2\p32\include\non-free -IC:\Pinguino32X.2\p32\include\pinguino\core -IC:\Pinguino32X.2\p32\include\pinguino\libraries -IC:\Pinguino32X.2\p32\lkr\PIC32_PINGUINO_MICRO -IC:\Pinguino32X.2\examples\10.Libraries\SD -IC:\Pinguino32X.2\p32\obj\non-free -o C:\Pinguino32X.2\source\main32.elf C:\Pinguino32X.2\source\main32.c \
        C:\Pinguino32X.2\p32\obj\non-free\crt0.S \
        C:\Pinguino32X.2\p32\obj\non-free\processor.o \
        C:\Pinguino32X.2\p32\obj\non-free\usb\libcdc.a \
        C:\Pinguino32X.2\p32\obj\non-free\usb\libadb.a \
        C:\Pinguino32X.2\p32\lkr\PIC32_PINGUINO_MICRO\ISRwrapper.S \
        C:\Pinguino32X.2\p32\include\non-free\p32xxxx.h \
        -lm -lgcc -lc
In file included from C:\Pinguino32X.2\source\main32.c:32:0:
C:\Pinguino32X.2\p32\include\pinguino\core/newlib.c:91:28: warning: 'struct stat' declared inside parameter list
C:\Pinguino32X.2\p32\include\pinguino\core/newlib.c:91:28: warning: its scope is only this definition or declaration, which is probably not what you want
C:\DOCUME~1\Owner\LOCALS~1\Temp\cch0UwIt.o: In function `rcvr_datablock':
main32.c:(.text.rcvr_datablock+0x5c): undefined reference to `Delayus'
C:\DOCUME~1\Owner\LOCALS~1\Temp\cch0UwIt.o: In function `send_cmd':
main32.c:(.text.send_cmd+0xbc): undefined reference to `Delayus'
C:\DOCUME~1\Owner\LOCALS~1\Temp\cch0UwIt.o: In function `disk_initialize':
(.text.disk_initialize+0x1e0): undefined reference to `Delayus'
C:\DOCUME~1\Owner\LOCALS~1\Temp\cch0UwIt.o: In function `disk_initialize':
(.text.disk_initialize+0x278): undefined reference to `Delayus'
collect2: ld returned 1 exit status
make: *** [link] Error 1

In order for that code to compile I had to include delay.c in diskio.c and the stdout became:
Code:
if exist C:\Pinguino32X.2\source\main32.o @del C:\Pinguino32X.2\source\main32.o
if exist C:\Pinguino32X.2\source\main32.elf @del C:\Pinguino32X.2\source\main32.elf
if exist C:\Pinguino32X.2\source\main32.hex @del C:\Pinguino32X.2\source\main32.hex
if exist C:\Pinguino32X.2\p32\obj\non-free\processor.o @del C:\Pinguino32X.2\p32\obj\non-free\processor.o
        1 file(s) copied.
C:\Pinguino32X.2\win32\p32\bin\mips-gcc.exe -EL -O3 -ffunction-sections -fdata-sections -Wl,--gc-sections -march=24kc -msoft-float -Wl,-LC:\Pinguino32X.2\p32\obj\non-free -Wl,--defsym,_min_heap_size=16384 -Wl,-Map=C:\Pinguino32X.2\source\output.map -D __PIC32MX__ -D __32MX440F256H__ -D PIC32_PINGUINO_MICRO -TC:\Pinguino32X.2\p32\lkr\PIC32_PINGUINO_MICRO\procdefs.ld -TC:\Pinguino32X.2\p32\lkr\PIC32_PINGUINO_MICRO\elf32pic32mx.x -LC:\Pinguino32X.2\p32\obj\non-free\usb -lm -lgcc -lc -fdollars-in-identifiers -IC:\Pinguino32X.2\p32\include\non-free -IC:\Pinguino32X.2\p32\include\pinguino\core -IC:\Pinguino32X.2\p32\include\pinguino\libraries -IC:\Pinguino32X.2\p32\lkr\PIC32_PINGUINO_MICRO -IC:\Pinguino32X.2\examples\10.Libraries\SD -IC:\Pinguino32X.2\p32\obj\non-free -o C:\Pinguino32X.2\source\main32.elf C:\Pinguino32X.2\source\main32.c \
        C:\Pinguino32X.2\p32\obj\non-free\crt0.S \
        C:\Pinguino32X.2\p32\obj\non-free\processor.o \
        C:\Pinguino32X.2\p32\obj\non-free\usb\libcdc.a \
        C:\Pinguino32X.2\p32\obj\non-free\usb\libadb.a \
        C:\Pinguino32X.2\p32\lkr\PIC32_PINGUINO_MICRO\ISRwrapper.S \
        C:\Pinguino32X.2\p32\include\non-free\p32xxxx.h \
        -lm -lgcc -lc
In file included from C:\Pinguino32X.2\source\main32.c:32:0:
C:\Pinguino32X.2\p32\include\pinguino\core/newlib.c:91:28: warning: 'struct stat' declared inside parameter list
C:\Pinguino32X.2\p32\include\pinguino\core/newlib.c:91:28: warning: its scope is only this definition or declaration, which is probably not what you want
C:\Pinguino32X.2\win32\p32\bin\mips-objcopy.exe -O ihex C:\Pinguino32X.2\source\main32.elf C:\Pinguino32X.2\source\main32.hex
copy C:\Pinguino32X.2\source\main32.hex C:\Pinguino32X.2\source\main32tmp.hex  
        1 file(s) copied.

And the code would still not turn on the yellow led.

At this point I believe that there is something in the SD library that is stopping SD code from working on my x.2/MICRO setup.

Is that a logical assumption to make before I continue? Huh

Should I be going down other roads at this point? Huh

I would like to see if I can get SD to work on my MICRO using full x.3 but I am still unable to compile in my x.3 setup Huh

Thanks in advance on this one if you are still with me Rolleyes
Dale
PIC32-Pinguino-OTG Rev C and PIC32-PINGUINO-MICRO rev.B
Win XP SP3
r381 x.3 Big Grin
AND spi.c {} error fixed
AND sdmmc.c pin error fixed
AND diskio.c fixed, MICRO can't use the RTCC
AND analog.c fixed for MICRO
Reply
04-05-2012, 09:44 PM,
#17
RE: PIC32 PINGUIONO's and SD
Dale,

sorry if I seem to be "loosing the plot" but could you remind me which version of X.2 you are using as the base and ALL the changes you have made to that version and I will try to reproduce it on a Windows computer for the PIC32 Pinguino OTG. If you have created it using SVN checkout, let me know which version was reported when you did the checkout/update. Also if you have substituted individual files, what was the version of the file you have substituted. There is definitely something odd if you need to start #including files (although it is not unknown as I recently found a missing #include in the RTCC.c library that was dealt with in X.3 r359). Normally the #includes should be dealt with by the IDE in conjunction with library files.

Also I get similar warnings to those you report when I compile but they have not stopped the program from running as expected on the OTG board.

Regards
Board = PIC32-Pinguino-OTG Rev C
OS = Linux Unbuntu 11.10 till 26 Apr 2012
OS = Linux Unbuntu 12:04 from 27 Apr 2012
Reply
04-05-2012, 11:25 PM, (This post was last modified: 05-05-2012, 12:51 AM by KiloOne.)
#18
RE: PIC32 PINGUIONO's and SD
I installed with PinguinoX.2 rev305 setup.exe on Mar 14, 2012. I have always thought it strange that the IDE never reported a rev num, always said rev unknown.

And, just now I ran that 305 setup to this new folder C:\Pinguino32X.2-305\

I then deleted this directory: C:\Pinguino32X.2-305\p32\include\pinguino\libraries\sd

And replaced it with this x.3 r377 directory: F:\!---Dale\Electric Lazair\Pinguino\X.3\examples\10.Libraries\SD

And I copied F:\!---Dale\Electric Lazair\Pinguino\X.3\p32\pdl\sd.pdl32 to C:\Pinguino32X.2-305\p32\lib\sd.pdl32 , replacing the existing file that was there.

I put the below YellowWithMount.pde in: C:\Pinguino32X.2-305\examples\10.Libraries\SD

I the ran C:\Pinguino32X.2-305\pinguino.exe, loaded YellowWithMount.pde and compiled it for MICRO and got this stdout:
Code:
if exist C:\Pinguino32X.2-305\source\main32.o @del C:\Pinguino32X.2-305\source\main32.o
if exist C:\Pinguino32X.2-305\source\main32.elf @del C:\Pinguino32X.2-305\source\main32.elf
if exist C:\Pinguino32X.2-305\source\main32.hex @del C:\Pinguino32X.2-305\source\main32.hex
if exist C:\Pinguino32X.2-305\p32\obj\non-free\processor.o @del C:\Pinguino32X.2-305\p32\obj\non-free\processor.o
        1 file(s) copied.
C:\Pinguino32X.2-305\win32\p32\bin\mips-gcc.exe -EL -O3 -ffunction-sections -fdata-sections -Wl,--gc-sections -march=24kc -msoft-float -Wl,-LC:\Pinguino32X.2-305\p32\obj\non-free -Wl,--defsym,_min_heap_size=16384 -Wl,-Map=C:\Pinguino32X.2-305\source\output.map -D __PIC32MX__ -D __32MX440F256H__ -D PIC32_PINGUINO_MICRO -TC:\Pinguino32X.2-305\p32\lkr\PIC32_PINGUINO_MICRO\procdefs.ld -TC:\Pinguino32X.2-305\p32\lkr\PIC32_PINGUINO_MICRO\elf32pic32mx.x -LC:\Pinguino32X.2-305\p32\obj\non-free\usb -lm -lgcc -lc -fdollars-in-identifiers -IC:\Pinguino32X.2-305\p32\include\non-free -IC:\Pinguino32X.2-305\p32\include\pinguino\core -IC:\Pinguino32X.2-305\p32\include\pinguino\libraries -IC:\Pinguino32X.2-305\p32\lkr\PIC32_PINGUINO_MICRO -IC:\Pinguino32X.2-305\examples\10.Libraries\SD -IC:\Pinguino32X.2-305\p32\obj\non-free -o C:\Pinguino32X.2-305\source\main32.elf C:\Pinguino32X.2-305\source\main32.c \
        C:\Pinguino32X.2-305\p32\obj\non-free\crt0.S \
        C:\Pinguino32X.2-305\p32\obj\non-free\processor.o \
        C:\Pinguino32X.2-305\p32\obj\non-free\usb\libcdc.a \
        C:\Pinguino32X.2-305\p32\obj\non-free\usb\libadb.a \
        C:\Pinguino32X.2-305\p32\lkr\PIC32_PINGUINO_MICRO\ISRwrapper.S \
        C:\Pinguino32X.2-305\p32\include\non-free\p32xxxx.h \
        -lm -lgcc -lc
In file included from C:\Pinguino32X.2-305\p32\include\pinguino\libraries/sd/diskio.c:16:0,
                 from C:\Pinguino32X.2-305\p32\include\pinguino\libraries/sd/fileio.c:27,
                 from C:\Pinguino32X.2-305\source\/define.h:7,
                 from C:\Pinguino32X.2-305\source\main32.c:29:
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c: In function 'RTCC_init':
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c:271:15: error: 'INT_REAL_TIME_CLOCK' undeclared (first use in this function)
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c:271:15: note: each undeclared identifier is reported only once for each function it appears in
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c: In function 'RTCC_Shutdown':
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c:290:15: error: 'INT_REAL_TIME_CLOCK' undeclared (first use in this function)
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c: In function 'RTCC_Open':
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c:454:15: error: 'INT_REAL_TIME_CLOCK' undeclared (first use in this function)
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c: At top level:
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c:482:6: warning: conflicting types for 'RTCC_AlarmDisable'
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c:269:2: note: previous implicit declaration of 'RTCC_AlarmDisable' was here
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c:833:6: warning: conflicting types for 'RTCC_OutputDisable'
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c:270:2: note: previous implicit declaration of 'RTCC_OutputDisable' was here
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c: In function 'RTCC_SetAlarmIntEnable':
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c:851:22: error: 'INT_SYSTEM_CONFIG_MULT_VECTOR' undeclared (first use in this function)
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c:852:24: error: 'INT_RTCC_VECTOR' undeclared (first use in this function)
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c:852:41: error: 'INT_PRIORITY_3' undeclared (first use in this function)
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c:852:57: error: 'INT_SUBPRIORITY_1' undeclared (first use in this function)
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c:853:16: error: 'INT_REAL_TIME_CLOCK' undeclared (first use in this function)
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c: In function 'RTCCInterrupt':
C:\Pinguino32X.2-305\p32\include\pinguino\core/rtcc.c:884:17: error: 'INT_REAL_TIME_CLOCK' undeclared (first use in this function)
In file included from C:\Pinguino32X.2-305\source\main32.c:32:0:
C:\Pinguino32X.2-305\p32\include\pinguino\core/newlib.c: At top level:
C:\Pinguino32X.2-305\p32\include\pinguino\core/newlib.c:91:28: warning: 'struct stat' declared inside parameter list
C:\Pinguino32X.2-305\p32\include\pinguino\core/newlib.c:91:28: warning: its scope is only this definition or declaration, which is probably not what you want
In file included from C:\Pinguino32X.2-305\source\main32.c:36:0:
C:\Pinguino32X.2-305\source\/user.c: In function 'setup':
C:\Pinguino32X.2-305\source\/user.c:5:10: error: 'YELLOWLED' undeclared (first use in this function)
make: *** [link] Error 1

It is that easy (I did it twice just now, 2nd time was 10 minutes), the stdout above has more errors than I reported in my last post, I will investigate why that is but this gets you in the ballpark rather easily. I did not need my MICRO board at all to get this far.

Ha, the YELLOWLED undeclared is in there too Wink

The RTCC errors probably have something to do with the RTCC use in diskio.c and possibly with the missing include you found.

Aha, I just firgured out that I had also transfered to my Mar-14 305 install, rtcc.pdl32, rtcc.c and const.c.

If you are still following this and you do that too, you will get the stdout at STAGE 3 of my post #16 in this thread, so I am going to use the unheard of command (tsk, tsk) goto here Big Grin

Thanks,
Dale

At least I am still Big Grin ing


Attached Files
.pde   YellowWithMount.pde (Size: 259 bytes / Downloads: 1)
PIC32-Pinguino-OTG Rev C and PIC32-PINGUINO-MICRO rev.B
Win XP SP3
r381 x.3 Big Grin
AND spi.c {} error fixed
AND sdmmc.c pin error fixed
AND diskio.c fixed, MICRO can't use the RTCC
AND analog.c fixed for MICRO
Reply
05-05-2012, 12:23 AM,
#19
RE: PIC32 PINGUIONO's and SD
Dale,

I had a quick look and I think there are a lot more changes that you will need to do to get a workable environment for use with a Micro if you start with x.2 r305.

Browsing the X.3 directory (see X.3 changes after r305) there were quite a lot of changes that were introduced specifically to deal with the Micro - r308, r309, r312 and r318 specifically identify the Micro but there could well be others. I will have a more detailed look at it in the morning as it is getting late here (UK).

The RTCC errors are caused by a missing #include in RTCC.c. This was fixed recently for X.3 (r359) as per my earlier post.

Regards
Board = PIC32-Pinguino-OTG Rev C
OS = Linux Unbuntu 11.10 till 26 Apr 2012
OS = Linux Unbuntu 12:04 from 27 Apr 2012
Reply
05-05-2012, 12:46 AM,
#20
RE: PIC32 PINGUIONO's and SD
(05-05-2012, 12:23 AM)mf01 Wrote: I had a quick look and I think there are a lot more changes that you will need to do to get a workable environment for use with a Micro if you start with x.2 r305.

305 is the latest stable code that people are installing isn't it? It looks like they will have to follow my current path if they want to use SD with MICRO, I wish I could just get x.3 compiling and I would give up on this x.2 bumpy road Confused

Thanks for tagging along, I hope I don't wear you out.

Dale
PIC32-Pinguino-OTG Rev C and PIC32-PINGUINO-MICRO rev.B
Win XP SP3
r381 x.3 Big Grin
AND spi.c {} error fixed
AND sdmmc.c pin error fixed
AND diskio.c fixed, MICRO can't use the RTCC
AND analog.c fixed for MICRO
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)