Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PIC32 PINGUIONO's and SD
05-05-2012, 01:14 AM,
#21
RE: PIC32 PINGUIONO's and SD
Dale,

just for your info X.3 r378 has bust the IDE on two Windows computers (one Vista and one 7) for me. Although I don't think this is your problem just be ware of it if you are still trying to get X.3 running. I have just posted an error report in another area of the forum.

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, 01:27 AM,
#22
RE: PIC32 PINGUIONO's and SD
(05-05-2012, 01:14 AM)mf01 Wrote: Dale,

just for your info X.3 r378 has bust the IDE on two Windows computers (one Vista and one 7) for me. Although I don't think this is your problem just be ware of it if you are still trying to get X.3 running. I have just posted an error report in another area of the forum.

Regards

Thanks,

I won't update past the 377 I am at now, while I try to get it compiling.

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, 10:58 AM, (This post was last modified: 05-05-2012, 11:00 AM by mf01.)
#23
RE: PIC32 PINGUIONO's and SD
Hi Dale,

1. The problem with r378 I let you know about has been resolved by r381 - a very good and fast response by YeisonEng.

2. Although I have not researched this further yet, whilst the changes to X.2 r305 to get the SD functions working with the PIC32 Pinguino OTG board are relatively few and manageable (as the OTG board was supported in X.2 prior to r305) support for the PIC32 Pinguino Micro was not introduced till after r305 and most of the changes to support the Micro board have not been incorporated into the Trunk/X.2. I am not saying that it is not possible to modify X.2 r305 to support the Micro board, just that it will need a lot of research to identify all the necessary file changes. At the time the SD library was developed the Pinguino IDE did not support the PIC32 Pinguino Micro, (which I think did not become available till later) and so it based around the OTG board and did not take the Micro into account and this is probably the fundamental reason for some of the problems you have been having with trying to get it working on the Micro.

3. The SD library makes use of the RTCC library for the time and date when writing a file to a card. There is a note in the appropriate file (diskio.c) that says that it assumes that the RTCC has been set and running. What I had forgotten was that the inclusion of the setting of the RTCC at the start of the DataLogger.pde example was to cover the assumption in the diskio.c file as well as providing the data to be written. Therefore any program that writes data to an SD card using the current version of the SD library needs to first set the RTCC and this has two implications which I will cover separately below.

4. I recently found a problem with another program that resulted in the setting data for the real time clock getting corrupted. I did not manage to fully determine the cause but did find that if the setting data was put in setup( ) rather than where it is the DataLogger.pde example then the problem did not occur. This means that the setup ( ) becomes :-

Code:
void setup() {
    const    u32     Tm           = 0x10170000; // Time for clock setting             format = 0xHHMMSS00
    const    u32     Dt           = 0x12011703; // Date and day for clock setting     format = 0xYYMMDD0W
                                                //    W = day of week,    Saturday = 0 Friday = 6
                                                // see array Day[][] above
    const    u16     drift        = 180;        // add 180 pulses every minute to adjust time

    /*    Set Real Time Clock and Calendar */
    RTCC.open(Tm, Dt, drift);                    // Sets date, time and calibration & starts RTC
}

and the definitions of Tm, Dt and drift are removed from the start of the program.

5. The dependency of the current SD writing functions on the RTCC has implications for the PIC32 Pinguino Micro. As far as I can see, the Micro board does not have a 32,768 kHz crystal for the RTCC (compare the schematic for the Micro with that for OTG particularly to the left of the processor). When the RTCC is set, one of the things that is checked is that the secondary oscillator is running - I believe that the secondary oscillator is the one using the 32,768 kHz crystal. I think that the implication of this is that if you try to set the RTCC on the Micro board then it will never pass the test for the secondary oscillator being running and therefore never exit that part of the program. To use the SD library with the Micro this dependency needs to be dealt with (see below).

6. I think therefore you have two choices - the first one, and the simplest from the programming point of view is to use the PIC32 Pinguino OTG board. The changes needed to get this running from x.2 r305 are relatively straight forward and as it does have full RTCC support will enable you to date and time stamp any files written to the SD card. The second, and more complex, is to get an IDE environment that supports the Micro board and then modify the diskio.c file so that for the PIC32 Pinguino Micro it no longer makes use of the RTCC. You will need to think how you create a suitable date and time stamp for when files are written to the card. It may be that using a "fixed data and time" is sufficient for your purposes.

7. If the reason you are using the Micro board is the number of input and output lines you need you may want to look at "CON3" on the OTG board. The OTG board as supplied does not have a connector fitted but does have the pads for that connector. On one of my OTG boards I fitted a suitable connector - it was a bit fiddly as the pads at on 0.05" (1.27mm) centres and one of the capacitors and the power connector are rather close but it is doable with a steady hand and possibly a magnifying glass. There are 8/10 digital I/O available on CON3 (RE0-7, RD1 which is connected to the yellow LED and RF1 = IDE P22 - P31).

Hope this helps.

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, 01:19 PM, (This post was last modified: 05-05-2012, 01:29 PM by KiloOne.)
#24
RE: PIC32 PINGUIONO's and SD
Mark,

Great info, I had read the rtcc comments in diskio.c and wondered if that was the problem, sounds like it is. I think SD card library should be modified for all users anyway since you should not need rtcc info just to use SD. The library obviously intends to be used by the MICRO as there are defines and logic for it.

I will not be using rtcc unless the sleep mode current draw issue can be addressed, I have not gotten to work on that yet. Another post had already been started on that.

I really prefer to use MICRO but will go back to OTG if I can not resolve this, it would be a shame to waste the knowledge I have gained here.

WOW, no rtcc oscillator on the MICRO!!! Huh I am very disappointed and feel a little misled when I selected the MICRO. I think the Olimex MICRO datasheet should be changed and rather than including all the features that the PIC chip has, it should also note which ones are usable without adding external components or something to that affect. I was 'hoping' to use it at some point. Well at that point I could add the oscillator to the 'motherboard' I need to make for the MICRO anyway, on second thoughts I probably will add the traces and pads on v1 of the motherboard.

I need to add the motherboard shield because I need a 50v to 5v voltage supply, to add things like GPS, and now an oscillator, so there is no need for the extra power supply options, size and cost of the OTG. When I was going to use only one OTG on the airplane I had an I/O count problem with the OTG and I was intending to use the pads you speak of to solve it. Now with two 'brains' going to be on board, no more I/O problems.

I will report on the SD library edits I need to make, I can't see it being too hard (ha) Wink

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, 01:51 PM,
#25
RE: PIC32 PINGUIONO's and SD
Hi Dale,

as far as I can see the only places in diskio.c that refer to rttc.c are the #include <rtcc.c> at the beginning and then in get_fattime() towards the end.

The simplest "patch" to get you running might be to "bracket" the code from after DWORD tmr = 0; to before return tmr; with #if and #else and then include suitably modified copies of all the tmr = lines , just putting suitable fixed values for year, month, day, hour minute and second. Crude but it should let you get things working. Something alone the lines of :-

Code:
DWORD get_fattime(void) {
    DWORD tmr = 0;
#if !defined (PIC32_PINGUINO) && !defined (PIC32_PINGUINO_OTG)
    rtccTime pTm, cTm;
    rtccDate pDt, cDt;

    RTCC_GetTimeDate(&pTm, &pDt);    // get time and date from RTC
                                    // assumes RTC has been set and is running
                                    // OK - could be expanded to check that RTC
                                    // is running and that a valid value is
                                    // being returned by the RTC
    cTm = RTCC_ConvertTime(&pTm);    // convert time from bcd to decimal format
    cDt = RTCC_ConvertDate(&pDt);    // convert date from bcd to decimal format

    /* Pack date and time into a DWORD variable */
//    tmr = (((DWORD) pDt.year - 80)) | ((DWORD) pDt.mon) | ((DWORD) pDt.mday)
//            | (WORD) (pTm.hour) | (WORD) (pTm.min) | (WORD) (pTm.sec);
    tmr = cDt.year + 20;
    tmr = (tmr << 4) | cDt.mon;        // shifts left 4 bits and adds month
    tmr = (tmr << 5) | cDt.mday;    // shifts left 5 bits and adds m.day
    tmr = (tmr << 5) | cTm.hour;    // shifts left 5 bits and adds hour
    tmr = (tmr << 6) | cTm.min;        // shift left 6 bits and adds minutes
    tmr = (tmr << 5) | (cTm.sec/2);    // shifts left 5 bits and adds seconds/2

#else
    tmr = 12 + 20;
    tmr = (tmr << 4) | 5;        // shifts left 4 bits and adds month
    tmr = (tmr << 5) | 5;    // shifts left 5 bits and adds m.day
    tmr = (tmr << 5) | 12;    // shifts left 5 bits and adds hour
    tmr = (tmr << 6) | 0;        // shift left 6 bits and adds minutes
    tmr = (tmr << 5) | (0/2);    // shifts left 5 bits and adds seconds/2
#endif

    return tmr;
}

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, 02:36 PM, (This post was last modified: 05-05-2012, 03:21 PM by KiloOne.)
#26
RE: PIC32 PINGUIONO's and SD
Hurray for baby baby steps Smile

In addition to your above edit, I had to add an #include <delay.c> in diskio.c in order to compile this:
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()  {
}

But it did compile for the MICRO on Pinguino32X.2-305 (with noted edits) with no errors.

Unfortunately, when uploaded, still no activity (no yellow led).

Another bump is in the road Huh

Dale

I can't stop Big Grin ing. Big GrinBig GrinBig GrinBig GrinBig GrinBig Grin

What has it been 20 minutes or so since I uploaded the program and I was just looking at the MICRO and the yellow led comes on Big Grin

Push reset, nothing, I'll wait and see if it comes on in 20 minutes again.

Dale

And there it goes again, another yelow light Big GrinBig GrinBig GrinBig GrinBig GrinBig GrinBig Grin

And this is suppose to be 80mhz Big GrinBig GrinBig Grin , crying soon....

That was after at least ten minutes (I am not wasting my time watching it every second)
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, 04:51 PM, (This post was last modified: 05-05-2012, 06:41 PM by mf01.)
#27
RE: PIC32 PINGUIONO's and SD
Dale,

I have been doing some more digging and tried to identify all the differences between x.2 r305 and x.3 r381. Using a program called Meld on Ubuntu, I have identified the following files as being different in the /core and /pdl (or/lib in x.2) folders.

/p32/include/pinguino/core/core

__cdc.c
analog.c - PIC32 Pinguino Micro support added
bcd.c
const.h - PIC32 Pinguino Micro LEDs added
debug.c
digitalw.c - PIC32 Pinguino Micro additional pins added
i2c.c
interrupt.c
itoa.c - editorial only - no signficance
macro.h
millis.c - mainly changes for PIC32 Pinguino 220
newlib.c - editorial only - no significance
pinguinoi2c1.c
pinguinoi2c2.c
printf.c
pwm.c - PIC32 Pinguino Micro support added
rtcc.c - bug fixes and other changes not specific to PIC32 Pinguino Micro
serial.c
system.c
typedef.h - clean up of type definitions not specific to PIC32 Pinguino Micro

/p32/lib
1wire.pdl32 - change of format of function names in 18b20.c
bluetooth.pdl32
dcf77.pdl32 - new file in X3
debug.pdl32
Pi2c.pdl32 - new file in X.3
pi2c1.pdl32
pi2c2.pdl32
pserial.pdl32
pserial1.pdl32
pserial2.pdl32
pserial3.pdl32
pserial4.pdl32
pserial5.pdl32
pserial6.pdl32
rtcc.pdl32 - some function name changes in rtcc.c but those functions unlikely to be called directly by user
sd.pdl32 - significant changes
serial.pdl32
stepper.pdl32
system.pdl32
typedef.pdl32 - one extra typedef, refers to typedef.h

As you can see it is a long list and I think includes quite a few files in addition to the ones you have already "transplanted". Quite a few of them may have nothing to do with the functions you are using, but some of them might do. I have tried to delve a little deeper and see which are the most likely candidates and updated this post accordingly.

I don't know if you have any software comparable to Meld on your Windows PC - Alternativeto identified WinMerge as a possible alternative - but it may help identify the critical 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, 05:58 PM, (This post was last modified: 05-05-2012, 08:11 PM by KiloOne.)
#28
RE: PIC32 PINGUIONO's and SD
Mark,

OK I have gotten over my laughing fit.

I have copied my x.2-305 dir with all the edits as per above posts to a new folder and then I tortoised to r381.

I then copied all the files you identified above (names as edited Wink ) from r381 to x.2-305-to-x.3-381 dir.

EDIT ... IGNORE ==> (Actually, there is no io.c in x.2 but there is in x.3, are you sure your list accounts for all the file differences including new files in x.3 and files no longer there?)

Then I compiled the short above code (for MICRO) to turn on yellow led, then do an SD mount.

I got this stdout:
Code:
if exist F:\!---Dale\Electric Lazair\Pinguino\Pinguino32X.2-305-to-X.3-381\source\main32.o @del F:\!---Dale\Electric Lazair\Pinguino\Pinguino32X.2-305-to-X.3-381\source\main32.o
if exist F:\!---Dale\Electric Lazair\Pinguino\Pinguino32X.2-305-to-X.3-381\source\main32.elf @del F:\!---Dale\Electric Lazair\Pinguino\Pinguino32X.2-305-to-X.3-381\source\main32.elf
if exist F:\!---Dale\Electric Lazair\Pinguino\Pinguino32X.2-305-to-X.3-381\source\main32.hex @del F:\!---Dale\Electric Lazair\Pinguino\Pinguino32X.2-305-to-X.3-381\source\main32.hex
if exist F:\!---Dale\Electric Lazair\Pinguino\Pinguino32X.2-305-to-X.3-381\p32\obj\non-free\processor.o @del F:\!---Dale\Electric Lazair\Pinguino\Pinguino32X.2-305-to-X.3-381\p32\obj\non-free\processor.o
The system cannot find the file specified.
make: *** [copy] Error 1

Although this did not compile, I am glad to see it. Why, because this is exactly the error I get when trying to compile from any x.3 (using the python IDE) install I have done.

If we can only solve this we may solve a lot of my problems.

Dale

ps I LOVE WinMerge !!! Big Grin


And more....... well the new file io.c does not have a MICRO condition in it, don't know if it matters but I think it should matter by my logic.

Also, I have another clue, I just realized that stdout does not portray all the compiling error info!!!

I just noticed that the error shown in the IDE window is not necessarily included in the stdout file.

So, I think the missing link is this IDE window compile error (CORRECTED):
Code:
Board:    PIC32 Pinguino Micro
Proc:     32MX440F256H
error while linking F:\!---Dale\Electric Lazair\Pinguino\Pinguino32X.2-305-to-X.3-381\examples\10.Libraries\SD\YellowWithMount.o

So the missing file is YellowWithMount.o in the directory of the .pde file.

Now, someone who knows more than I Wink should be able to figure out why it is not there.

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, 07:22 PM, (This post was last modified: 05-05-2012, 07:25 PM by mf01.)
#29
RE: PIC32 PINGUIONO's and SD
Hi Dale,

the lists in my last posts only covered the differences in the two folders identified. I had missed out two files that had been added to X.3 which I have now added to my last post labelled with "new file in X.3".

On my linux computer the same io.c file exists in both X.2 305 and x.3 r381, hence it was not in the list. The same is true on my W7 computer so not sure why you were not seeing it in your x.2 r305.

Have you tried looking at the Makefile.win32 in the /source folder ? It is what is driving the compile process and the lines included in your last post correspond to some of the commands in that file. As far as I can see the Makefile.win32 is the same in both X.2 r305 and X.3 r381 bar a few tabs/spaces so something in the arrangement of the files compared with your earlier X.2 r305 might be causing a problem.

Additional thought - to help find the cause of the compile failure compare the stdout file you have with that of a successful compile - it may help flag the step that is failing.

Just a thought that occurred - one difference between what you appear to have on your computer and the set-up I am running is that I took the default location for the install of r.305, i.e. at the top level of my hard drive (C: ). Is it possible with the location you have chosen you are running into problems with the length of the path name ? What is the significance of the "!---" in the "if exist" lines in the error report is?. Also I have sometimes seen problems due to spaces in file and folder names - on one computer (and and I cannot remember which OS it was) I had quite a few problems getting the IDE to compile with certain non-alpha numeric items, including spaces, in the folder names.

Regards

Mark
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, 08:04 PM, (This post was last modified: 05-05-2012, 08:09 PM by KiloOne.)
#30
RE: PIC32 PINGUIONO's and SD
I will start tracking down these leads.

Sorry, io.c was there in my x.2, I was trying to refer to a filename that was in your list but not in either but then your list corrected itself and I got confused.

I also made a correction above to the IDE error code I posted (I copied from the wrong IDE window). I am sure I am getting close to the number of Pinguino tree copies that you have Cool

The !--- in my folder name is just a convention I have for myself. I place that folder in the root dir of any hard drive I keep data on and then, due to sort order of those characters it will always put my dir on the top of a windows file explorer tree list.

They are legal characters for windows folders.

I also believe that those characters and the space have no significance here as I have three Pinguino x.3 folders directly off the root dir, including the new x.3 r381 from the .exe install just posted (there was no option to change dir name or location in that install) and they all result in the same error, which I think boils down to, looking for a <anyprogram>.o file in the same dir as the <anyprogram>.pde.

I will check out the makefile and I will try to use the debug hack you recently suggested and the other suggestions.

With this new super x.2-305 to r381 tree, I can not obtain any error free compile, even blink.pde.

Thanks,
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)