Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PIC32 PINGUIONO's and SD
05-05-2012, 09:18 PM,
#31
RE: PIC32 PINGUIONO's and SD
OK, thanks for the makefile lead, bingo.

What triggered my 'go back and look stupid' moment was when I realized that makefile was trying to delete files, if they exist, and when I put a file there with the name that was suppose to be deleted, it didn't get deleted and there was no change in stdout messages.

This lead me back to checking out your path character warnings, for real, not memory. (the truth sometimes hurts).

So, I have to eat my words, I went back and checked where I actually put the x.3 trees. I thought I put them off the root but they were off !---Dale, ouch.

LESSON - DO NOT USE '!' IN YOUR PINGUINO PATH NAMES

And I was wrong about the error that I get when I try to run the new x.3 r381 from the .exe install, it was not a compile error, it was a pinguino.log error.

I guess I am just getting tired and trying to take shortcuts, sorry.

Anyway, I can compile in x.3 and x.2-updatedto381.

I will let you know what happens when I try to run SD progs in MICRO.

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
05-05-2012, 09:22 PM,
#32
RE: PIC32 PINGUIONO's and SD
Hi Dale,

I'm sorry if I did not make myself clear with my comments about file and path names - the file and paths names were valid for the operating system, but they still seemed to cause problems. A folder that I had used to store .pde files in started to cause compile errors, it may have happened after I had done a change to the version of the IDE I was using but I am not sure. I never tracked down the full reason I just got it working and moved on. - but seeing your updated post which appeared whilst I was drafting this I think you have already worked this out.

The next line in the Makefile.win32 copies and renames the file for the selected processor as processor.o. If I have read makefile.win32 correctly both the source and target file are in folder /p32/obj/non-free. To confirm this I have tried compiling a simple program several times, with different processors selected. As the individual processor files have quite different sizes it is possible to tell if this step is being completed OK irrespective of the stdout file.

Also looking at the stdout file compared with that for a successful or even unsuccessful one where the problem was tih the actual program file, I would expect to see some more lines - which suggests the problem is not the actual .pde file or even the the various library and pdl files.

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, 10:37 PM, (This post was last modified: 05-05-2012, 11:16 PM by KiloOne.)
#33
RE: PIC32 PINGUIONO's and SD
Yep, aren't things like this fun.

OK, so I now have x.3 python IDE updated to r381 in its own directory off the root directory of F drive (not managed by tortoise and I will keep track of my changes).

I can now compile and use a slightly modified blink.pde to make the yellow led blink on my MICRO:
Code:
/*
    Blink a LED
*/
#include <const.h>

  
void setup()
{                
    // initialize the digital pin as an output.
    pinMode(YELLOWLED, OUTPUT);    
}

void loop()
{
    toggle(YELLOWLED);            // alternate ON and OFF
    delay(1000);        // wait for a second
}

YEA!!!!!!

But, my simple code that should turn on the yellow LED and then mount the SD will not work. To compile the following code, I had to modify sdmmc.h and diskio.c, both of which are attached and my and mf01's edits are identified at each //dk location:
Code:
#include <const.h>

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

void loop()  {
}

And the yellow LED had done one late turn on again, 10 minutes or so after upload.

Has not done it after a reset yet (15 min and counting).

I have modified makefile32.win32 to save the .i, .s and .o temp files but they are russian to me. I have attached them in a zip file.

Has anyone got the SD to work on a MICRO yet?

Dale


Attached Files
.zip   YellowWithMount-i-s-0-files.zip (Size: 156.81 KB / Downloads: 2)
.h   sdmmc.h (Size: 2.53 KB / Downloads: 3)
.c   diskio.c (Size: 19.26 KB / Downloads: 3)
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, 11:01 PM,
#34
RE: PIC32 PINGUIONO's and SD
Hi Dale,

sorry in suggesting the modifications to the diskio.c I managed to get things mixed up - I was considering two ways of dealing with the Micro and managed to get the code confused

#if !defined (PIC32_PINGUINO) && !defined (PIC32_PINGUINO_OTG)

should perhaps be

#if defined (PIC32_PINGUINO) || defined (PIC32_PINGUINO_OTG)

The code as I originally, and wrongly suggested, would guarantee that the Micro did not run - whoops and sorry (those damn exclamation marks Huh ).

Also given you success at getting the IDE to run you might want to update your signature Wink.

Have you managed to get CDC working - if so you might want to try reading from a card, either a directory or a file - it is a lot less complex and does not need access to the RTCC..

Also you might want to try changing mount(8) to mount(40) - 8 is the SDCS connection for the OTG card and although it would appear that for the Micro card some of the earlier changes should ensure that the correct SDCS line is used, it should do no harm to use the correct P number.

Regards and apologises
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, 11:05 PM, (This post was last modified: 05-05-2012, 11:22 PM by KiloOne.)
#35
RE: PIC32 PINGUIONO's and SD
Are you kidding, you are my hero!!!

I hate the new (for me) ||, |, !=, having to use == in conditions etc.

Code is updated and the file I posted is too, I think only you had downloaded it any way.

Unfortunately, the MICRO appears to act no different so far. Angry

Thanks,
Dale

My CDC is working but I have no way of catching setup CDC data yet.

Even if it could, not sure it matters much until I can get the first two lines of setup to turn on the yellow led consistently and in less than 10 minutes after a reset or upload.

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
05-05-2012, 11:50 PM,
#36
RE: PIC32 PINGUIONO's and SD
Hi Dale,

could you post your test program and the stdout file (after you have compiled but before you upload to the Micro) and I will have a look at them tomorrow and see if there is anything else I can think of that might be causing a problem.

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, 11:57 PM, (This post was last modified: 06-05-2012, 10:12 AM by KiloOne.)
#37
RE: PIC32 PINGUIONO's and SD
No problem!

And the yellow LED is coming on after a LONG time so the code is executing but just very slowly and only sometimes.

Thanks

Sorry, stdout had to have a file extension to post.

And I can now say that the all SD programs I compile and load on my OTG works AS EXPECTED!!


Attached Files
.pde   YellowWithMount.pde (Size: 260 bytes / Downloads: 3)
.txt   stdout.txt (Size: 2.24 KB / Downloads: 3)
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
06-05-2012, 10:42 AM,
#38
RE: PIC32 PINGUIONO's and SD
Hi Dale,

I think I am on the track of something that may help. I am just writing it up at the moment. I will give a fuller post when I have got to what looks like the light at the end of the tunnel (I hope it is not a train approaching from the other direction Wink ).

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
06-05-2012, 10:47 AM, (This post was last modified: 06-05-2012, 10:47 AM by KiloOne.)
#39
RE: PIC32 PINGUIONO's and SD
Great!

And a good morning to you too, still dark here though.

But you are Superman and can stop speeding trainsBig Grin

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
06-05-2012, 11:30 AM, (This post was last modified: 06-05-2012, 12:01 PM by mf01.)
#40
RE: PIC32 PINGUIONO's and SD
I do hope so - I think this is one I want to get off Wink

So far we have assumed that the changes made in the various library files to account for the PIC32 Pinguino Micro are correct. Now I am not saying that they are incorrect but as I can't think of anything else I thought it was worth testing that assumption. I have looked at the various files in the SD library and the following following files contain explicit references to the Micro :-

fileio.c x1
fileio.h x1
sdmmc.c x2
sdmmc.h x 1

I had already found that the changes in fileio.c and fileio.h "broke" the SD library for the PIC32 Pinguino OTG. Looking more closely at the change in sdmmc.h, the change there appears to change fundamentally what SDCS is. Previously SDCS was, and for the OTG card still is, a global varibale which contains the SD card select Pin Number. However I think that line in sdmmc.h changes what SDCS is for the Micro. I beleive that the effect is to tell the pre-processor that wherever SDCS occurs to replace it with the number, i.e. it effectively stops SDCS acting as a variable.

Of the five changes identified above only the two in sdmmc.c are consistent with how the SD library works for the OTG board and deal with the fact that the SD card slot does not have the ability to detect card presence or the setting of the write protect tab. Even if the Micro does ignoring them should not stop the SD library from running. The actual line does however look odd and perhaps :-
Code:
#if defined (PIC32_PINGUINO_OTG) || (PIC32_PINGUINO_MICRO)
should be
Code:
#if defined (PIC32_PINGUINO_OTG) || defined (PIC32_PINGUINO_MICRO)
Therefore I have remmed (//) out the lines for the micro in fileio.c, fileio.h and sdmmc.h and changing the two line in sdmmc.c as above.

I have done this in the SD library folder on my r381 working copy.

I have also changed your test program slightly to include a few more "flashes", one before mount and two shorter after.

Attached is a zip file with my modified SD library folder and the versions of YellowWithMount.pde and SimplifiedLoggerExample03May2012.pde

I have compiled both .pdes on my working copy of X.3 r381 and run these on an OTG board with the expected results. The only differences between my working copy of r381 and the reference copy is the SD library folder. I have also compiled them for a Micro board with no compile errors. The only change you need to make both files is to change the value in SD.mount( ) to match the board you are using, 8 for the OTG and I think 40 ? for the Micro.

I will be interested to know your results and where the next station is Wink

Regards

Hi Dale,

what I forgot to include in files attached to my last post were the changes we made to fileio.c to deal with the lack of RTCC on the Micro board, so you will need to include those changes in order to get the SimplifiedLoggerExample03May2012 to run on the Micro - sorry for this omission.

*** I have now updated the attachment to include an updated fileio.c - it is slightly different from what we used previously as I have set the fixed date & time to 01 Jan 2012 12:00:00 and included a couple of comments.

Regards


Attached Files
.zip   TryThis.zip (Size: 56.19 KB / Downloads: 5)
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


Forum Jump:


Users browsing this thread: 1 Guest(s)