Adding a FATfs "library" to a project?

Go To Last Post
32 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Greetings,

 

I want to add Elm-Chan's FATfs library to a current project (to access a microSD card). I have two problems - HOW to add and WHAT to add?

 

On the HOW front, there are three possible libraries - avr_foolproof, avr_complex, and ff10b. All are in folders with a slew of makefiles, readme, .s, .h, .c  files. So, do I add a whole folder to the project or do I go through and pick out the desired files, and bring those individually into the project? If it is whole folder, how do I reference the desired items that I need to use?

 

On the WHAT front, I think that I want to use avr_foolproof except that is written for bit-banged SPI, and I have to have the speed of hardware SPI.  The bit-bang SPI appears to be implemented in sdmm.c. avr_complex, on  the other hand, seems to use hardware SPI managed in mmc_avr.c. Can I simply swap the second one for the first one without having to change something in the code (since they are different names and appear not to have any header files). How do I tell Studio that the desired file needs to be part of the project? Elm-Chan seems to do all that in the make files and that is totally unknown territory for me.

 

So, I am seeking advice on the points, above, plus any other comments, suggestions, etc, relative to FATfs. I've been through the library's forum but I was able to glean very little out of that.

 

Thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Tue. Oct 14, 2014 - 05:08 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim,

There are a number of tutorials written on the use of FatFS.

The last time I worked with it I know Cliff made a new short description on what things to change in FatFs to get it to work. That was in the tutorials forum, so you could limit your search to that.

 

If I recall correctly, with the last few updates (at least the ones I have seen) a lot of things now a days can be set in a couple of config files (header files).

As fatFS does more than only doing sd card/mmc card control not all files that are in the example project need to be used. IIRC there are files for ATA control to and compact flash.

I have never used the make file provided, I always included all the needed files in the project and deleted the files I did not need.

I always start with getting the example project to work and then strip from there. If that does what I want I copied the files to my new project and get that to work.

 

special care has tobe taken with the SPI speed. When you initialize the SD card your speed needs to be below 400KHz ( that is what I remember, I am at work and played only at home with fatfs and could not find the project on my USb stick) after the init has been successful you can increase the speed.

 

hope this helps a bit

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks!

 

That is a big help. I don't use the tutorial section very often and I tend to forget about it. I'll will give it a good looking over tomorrow.

 

And, your point about clock speed explains why I saw a high speed and low speed defined. 

 

Appreciate your input!

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim,

 

when going through the tutorials section, keep in mind that there are a number of threads.

Some of them have faulty information, as such that they are based on the old version of FatFs. A lot has changed in that the last couple of years.

 

The last 2 times I did a re-start on FatFs I started with getting the demo to work and checking what I could throw out in there and strip it to the things I needed.

 

Note also that when you use the SPI bus also for other things that FatFs has its own SPI initialisation and as such might screw up your initialisation.

 

regards

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Personally I'd go with avr_complex. The"foolproof" one is foolproof in the sense that it doesn't use hardware SPI but bit-bangs it so works on tiny's with USI but no SPI. But you do NOT need all the files in the complex directry. YOu need to understand what each file is therefore then make your choice of what you need and what you don't.

 

A quick look (my version is a bit old so I may be out of date) suggests you would need:

 

ffconf.h

main.c (but hugely cut down!!)

mmc_avr.c

diskio.h

ff.h

xitoa.h

xitoa.S

integer.h

ff.c

 

Studio would need to be set up with most of the options in Makefile_mmc.

Last Edited: Wed. Oct 15, 2014 - 10:16 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, Cliff & Meslomp.

 

I'll try the sample project avr-complex directly. 

 

I was expecting something more "drop-in & play" - so I'll go through the code in detail and see what I can get rid of, like serial and sound. Hopefully more.

 

And, I'll review what I can of the major OS fwrite, fseek, and such. Only barely familiar with those. So much to do in a short time!

 

Again, thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim,

FatFs is becoming a more and more complete(and thus complex) package. It can do an awful lot.

In addition it can run on more and more processors, which also need more features.

 

do you only want to read, or have full access to both reading and writing.

IIRC the latest version of petitFs (also by chan) now a days also can do writing.

but having written that as you said you needed speed It might be that this version of FatFs is a bit to simple in the sence that is saves ram and program space, but has a big time penalty. I have never used that, but am sure someone who has been playing with it can comment on it.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

At the present time, it is write only. But, write and read in  the near future is highly desirable. This is a data logger. 

 

I have to write four signed 16-bit ASCII values as a csv "record" at up to 50 samples per second with maximum processor sleep in-between. So, processor write time is really important. 

 

So, right now, I am focussed on getting the FATfs "avr-complex" sample code running on my hardware with a Mega328. Just got boards which will be assembled in the next day or two. There will obviously also be the problem of  bringing up a totally new board. Going to be a busy boy. This is a very tight schedule!

 

Thanks, again, for your input and suggestions. I'd be dead without them.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

these are then indeed the exiting times....

sounds like an interesting project :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim,

 

This isn't by any chance related to your brother's (memory may be suspect) catchment emptying study of 12/24 months ago?

 

Cheers,

 

Ross

 

Ross McKenzie ValuSoft Melbourne Australia

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim,

 

Why not develop your app on an Arduino UNO with a microSD shield?

 

You will get your functionality up and running very swiftly.   e.g. <SPI.h> and <SD.h> libraries are part of Arduino.

 

You can test the resultant logfiles on your PC. (Mac)

 

Transferring the "sketch" to a regular C program on your custom hardware is relatively simple.    You have always got a 'working prototype' to compare with.   Then all you have to do is send the AVR to sleep.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Ross - No, not really related. Similar architecture but that is about it.

 

David - Never thought of Arduino, The schedule does not allow the luxury of prototyping on an Arduino. Got to provide a field-ready, battery-powered prototype in 3 or 4 weeks from now. Software is a different matter. I've always been uneasy about borrowing Arduino libs for for non-Arduino applications due to the unknown differences in development environments and the way that software specifies "pins". I took a quick look and found some notes ( http://arduino.cc/en/Reference/S... ) that refer to calls like SD.begin() which I have NO CLUE about how to handle in a "plain C" (didn't think I would ever use that phrase) environment. But, I will take a closer look.

 

Thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim,

 

You would write your prototype code on an Arduino in one evening.    And you would get your formatting,   human interface,   ... all finalised too!

 

Yes,   if you have not got the experience,    the re-write in C will take you a day or two.     But if you have already got the "working Arduino sketch",   you simply post here and say:   "having trouble with this method / function".

 

Ok,   I might start with a CV project and use its <ff.h> and <spi.h> library functions.     Or I might start from the Chan distribution and GCC.     But if I ran into a problem with some hardware,   I would dive to Arduino because this is where most manufacturers have examples.

 

If you are getting paid for the work,   a $12 Arduino clone is money well spent.    Even if you throw it away afterwards.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

In retrospect, Arduino is probably how I ought to have started. Time is short now. Whether I could gain enough by doing a quick Arduino dev is a big question.

 

I will spend a few hours with Arduino code and see where I get. I was starting down the Chan road, with the intention of getting sample code to compile this eve. The big problem I am seeing is just to figure out which library components are needed. The avr_complex sample includes things like ata.c and cfc.c which I don't think that I need. And something called cfmm.c which I cannot yet tell if it conflicts with or is needed by mmc_avr.c.

 

Thanks for the suggestions!

 

Hmmm, just took a look at SdFat-master on github - the core for the Arduino library. I see things (in the docs) that say "The ofstream class implements the C++ iostreams for writing text files." The words "class" and "C++ iostreams" scare me, big-time as I have no idea how to "port" these to C.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Thu. Oct 16, 2014 - 05:06 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim,

short side step.

how long does it need to operate on batteries?

Keep in mind that an SD/MMC card is rather power hungry(up to 100mA).

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmmm, just took a look at SdFat-master on github - the core for the Arduino library. I see things (in the docs) that say "The ofstream class implements the C++ iostreams for writing text files." The words "class" and "C++ iostreams" scare me, big-time as I have no idea how to "port" these to C.

That would scare me too.     Do you study the low-level operating system of your Mac before you first switch it on ?

 

Most people start with a factory made bicycle or motor car.     First off,   they learn how to drive it.     Only if it tickles their fancy,    do they study petrol chemistry,    engine design,    iron ore smelting, ....

 

So you would start your Arduino IDE,    find  the SD examples,    build them,   check them out.      You don't need a great intellect to get something up and running!     You can modify the existing examples.

 

I think that you are trying to complicate things (and meslomp is trying to frighten you).    My advice is to get your project functional before worrying about efficiency or power consumption.

 

For a start,     it would mean that you can show your customer a working prototype.     (and learn all the extras that she wants added to the project).

From your earlier thread,    I am sure that the battery life is deliverable.     But that is a pointless if you don't get the functionality correct.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

David,

I do not understand the part of frighting Jim.

If he needs the speed to talk to the SD card, it will draw a lot of current.

I have made the same mistake in thinking that the SD card would not draw a lot of power for a long time(I even did not think that with me connecting to the sd card at 400KHzSPI clock would make the Sd card draw a lot of current, but it did.

in the end I needed to use big batteries on my project to get the system running for the time it needed to minimally run (also a place were access was very limited) It had been my intention to build a small lean system with 4 penlights and a PCb on top. I ended up with 4 D cell batteries so the thing became very heavy and thus I also had to change mounting.......

I know Jim has been doing some 'out side' projects and as this might be one of them it is something I just wanted to warn him about.

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

AFIK,   Jim is intending to use C cells.    So it should have both sufficient capacity and peak current capability.    Yes,   of course he will have to take great care to sleep for as much as possible.

 

What concerns me is that he is starting from scratch.    e.g. unsure about SPI, unsure about fatFS,  unsure about SD Cards,  ...

 

I also worry about a high-humidity environment.    Only Jim and his client knows how hazardous this might be.

 

Oh,   and if you have got your prototype running,   you will soon see if you need D cells.    Let's face it.     Once you have gone past the AA/AAA stage,    you have already got something quite big and heavy.     And I guess that the Amazon is a big place.     Size will not matter too much in a permanent location.    Weight would only matter if you had to physically carry the thing.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The schedule does not allow the luxury of prototyping on an Arduino.

I fear you may have that sentence the wrong way round. If timescales are tight I would have thought that was even more reason to prototype. It usually saves more than it costs!

The avr_complex sample includes things like ata.c and cfc.c which I don't think that I need. And something called cfmm.c which I cannot yet tell if it conflicts with or is needed by mmc_avr.c.

which is exactly why I didn't include them in my list above ;-)

 

FYI:

 

ata.c = advanced technology attachment - which basically means "hard drive"

cfc.c = compact flash support - those are the flash cards that are about 2" by 1" and have a parallel (ATA in fact) interface

cfmm.c = a combination of cfc.c and mmc_avr.c  - it seems unlikely you have both SD/MMC and CF but if you do this ois the one to use ;-)

 

BTW do read the long FatFs thread in Tutorial. In one of the later pages I work through taking a fairly recent ffsample.zip and doing exactly what you are trying picking out only the files needed for sd/mmc and cutting down a main.c that does little more than open and read a file.

 

Cliff

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

JIm,

 

as I want to go have some 'fun' with fatfs myself I just did a quick search and foud this:

https://www.avrfreaks.net/comment...

 

I think this is the post Cliff is talking about.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yup I thin that's the one (interesting to see what the forum transfer did to some of the characters in the CODE blocks there!)

Last Edited: Fri. Oct 17, 2014 - 03:46 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Folks -

 

1) As I think about Arduino now, I do not understand the point of "prototyping" in an environment that is not transferable to a product. Yes,  I could learn more about using the standard functions like fseek. 

 

2) As for SD card power consumption, I am now confused. I had seen references to 100ma but the several OEM spec sheets that I was able to find talked about 20mA at max clock rate and seemed to imply lower current at slower clock rates. I had been going on the assumption that the current drops significantly between accesses. The spec sheets all had references to "idle current" or "stand-by current", (typically sub-1mA) though none gave the conditions where that current was the current level. I'm prepared for a prototype that has higher than expected energy consumption. However, I have to get something running to determine what to really expect.

 

3) I did see that thread in the tutorials but it seemed quite old. I didn't look at the end to see if there were recent posts :(  

 

4) Right now, I am having problems with an error: "unknown type name "prog_char"" with no type def for that in any of the original sample project (avr-complex) files. 

 

5) As I read FATfs, it seems to want 4K of ram for various buffers. Mega328 has a total of 2K. Maybe I need to fall back to Petite FS? Then, I'd need to replace the supplied USI code for SPI interfacing. The supplied code is a .s file though its header file does give the function prototypes. Bummers! 

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Yes,  I could learn more about using the standard functions like fseek. 

I think that was David's point - the SD stuff in Arduino (like most thnings) just works. So you can get on with the higher level design like making sure you are writing the right CSV format or whatever. This prevents the FatFs implementation blocking you and getting on with the overall system design so you are sure the overall solution works and you aren't going to hit any big roadblocks you hadn't thought about as you are bogged down getting the low level FatFs stuff to work. Meanwhile you work on getting FatFs working too. When it's ready you bolt your already working high level stuff on top.

As for SD card power consumption, I am now confused.

My understanding of SD/MMC is that they are pretty good at sleeping when they can. So yes they can consume large power when actually doing something (esp erase/write) but in the interim the current is negligible. So only if you plan continuous, intense writing would I be too worried just yet,

I didn't look at the end to see if there were recent posts

That thread is "organic". Chan changes FatFs over time and that thread tries to keep up ;-) (so yes you have to read to the end and yes the lack of "view all" here is a major PITA!)

Right now, I am having problems with an error: "unknown type name "prog_char"" with no type def for that in any of the original sample project (avr-complex) files. 

That's exactly the kind of organic - growing change I'm talking about. SprinterSB removed "prog_char" from AVR-LibC around the time avr-gcc got to 4.6. That's because it relied on a bug. You aren't supposed to be able to apply GCC __attribute__'s to typedefs but that's exactly what prog_char was doing. So these days replace prog_char with "const PROGMEM char" and all should be well. (actually "const __flash char" is an even better solution but perhaps a step too far?).

As I read FATfs, it seems to want 4K of ram for various buffers. Mega328 has a total of 2K.

You read wrong. First the main.c that accompanies avr_complex is a large test program and at one point it does a file to file copy so it has two FatFs File structures. Each one includes a 512 byte sector buffer (I think each is about 560 bytes totoal?) so it looks like you might need a bit over 1K of SRAM. However that's just for the supplied main.c and the big test code you don'#t actually want to keep (refer back to my post in the FatFs thread that Marcel linked to above). In normal use you are going to only deal with a single file so you need one large structure so maybe say 600 bytes in total. It should fit easily in a 2K RAM micro. If you think otherwise show your .map file.

 

Unless really pushed I would not revert to Petit. It's really cut down for low resource AVRs and does not even bufer the sector which means that every time it wants to access the Nth byte in a sector it has to read N-1 bytes of that sector to get to the right offset. So only use it if VERY pushed!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, Cliff -

 

I'll update those parameter lists in the couple of functions where they appear. I can do that.

 

Appreciate the insight on memory use and Petite FS. I'll keep chugging on FATfs, then.

 

Thanks for your support! This is pretty scary, with the prototype delivery so close. Gotta do the first board assembly today, and THAT is a challenge. One of the MUST have parts is an LGA-16 and that finally forces me to use a real oven for soldering. OH, I do hope it comes out OK.

 

By the way, that link, above, is VERY helpful.

 

Not worried about the environmental stuff, except low temperature (not likely to be an issue in the Amazon Rain Forest). Its all going into a nice Bud PN-1323 box with a herky mounting tab on each end. IP-65 rated. Clear cover to see diagnostic LEDs inside without opening the box. http://www.mouser.com/ProductDet...

 

One of the things that throws me on this new forum layout is that the "buttons" for anything other that the current thread page you are viewing are almost invisible. You get a nice blue or aqua button for the viewed page and its almost like they are ashamed to admit that there are other pages. Also, many of the few fora that I visit arrange the postings so that the newest is page 1. So, I tend not to look back to page 37. Just my habits!

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Fri. Oct 17, 2014 - 06:14 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Now I get error message in xitoa that " '__progmem__' attribute ignored [-Wattributes] " (not sure if those are single or double underscores in the error message) where ever I changed the assembler function prototype to something like

 

void xputs(const PROGMEM char *string);

xitoa is an assembler file (.s) and the header file provides c prototypes. Exactly the same message in main.c where there are statements in static void put_rc(FRESULT rc) like

 

const PROGMEM char *p;
static const PROGRMEM char str[] =
		"OK\0" "DISK_ERR\0" "INT_ERR\0" "NOT_READY\0" "NO_FILE\0" "NO_PATH\0"
		"INVALID_NAME\0" "DENIED\0" "EXIST\0" "INVALID_OBJECT\0" "WRITE_PROTECTED\0"
		"INVALID_DRIVE\0" "NOT_ENABLED\0" "NO_FILE_SYSTEM\0" "MKFS_ABORTED\0" "TIMEOUT\0"
		"LOCKED\0" "NOT_ENOUGH_CORE\0" "TOO_MANY_OPEN_FILES\0";

 

Hope someone can provide some insight.

 

<EDIT> Seems to build in spite of the errors shown. Guess those are warnings. But data memory is 178.3% full (Mega328). Where do I start pruning? And still concerned about those warnings. </EDIT>

 

<EDIT EDIT> Followup - appears to be an order issue in placement of PROGMEM. Changing the last definition to 

static const char str[] PROGMEM =

SEEMS to solve that one (though the manual seems to say otherwise) but I cannot find a proper placement for pointers (such as const char *p) and I can't find anything pertinent in the avr-libc manual. Just found PGM_P and that solves THIS problem.  </EDIT EDIT>

 

Sorry, I know that this has morphed into compiler-dom, but it is a logical continuation of the existing thread. Time to reread the linked thread previously referenced.

 

Thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Sat. Oct 18, 2014 - 04:31 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Clawson's post in the SD/MMC tutorial is JUST what the shrink ordered. I may yet retain a bit of sanity.

 

Ooopps, spoke too soon.

 

ff.h in Clawson's sample project has the declaration:

FRESULT f_mount (BYTE vol, FATFS* fs);

While the "same" file downloaded from the FATfs website has this:

 

FRESULT f_mount(FATFS* fs, const TCHAR* path, BYTE opt);

I guess I'll lift what Cliff has. Sanity is fading again, as are the hours left in this day. I see that Cliff's is FATfs R0.09.b while the "current" one is R0.10b  I have no clue about calling the new one. Or, if there will be problems substituting the old one. (along with the corresponding ff.c file)

 

Thanks

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Sat. Oct 18, 2014 - 06:34 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim,

 

I am sure that this going to fall on deaf ears.

 

Arduino <SD.h> just works.

Codevision <ff.h> just works.

They both have a selection of simple examples.

 

They are both built on stable releases of FATfs.     You would be up and running by bedtime.   (ok,   it would be my bedtime rather than yours)

 

Most importantly,    you would not be worrying about low-level technical details.     In fact,   you would have your prototype designed and running on high-level code.     In the process,   you would gain familiarity with filenames, files, creating files, writing records, ....

 

So when you come back to straight FATfs C code,   you will feel a lot more comfortable.

You would have a working prototype to test against.

 

I can not emphasise enough.     It is easy to translate a working Arduino sketch.    It is easy to get help when you can post a working system.      I bet that 90% of members own an Arduino.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

No it does not fall on deaf ears.

 

As I noted above, just took a look at SdFat-master on github - the core for the Arduino library (as far as I can tell). I see things (in the docs) that say "The ofstream class implements the C++ iostreams for writing text files." The words "class" and "C++ iostreams" scare me, big-time as I have no idea how to "port" these to C. I got the impression that this IS the Arduino standard sd "library" but I could be very wrong. 

 

Honestly,  have no clue about running the Arduino IDE or what <sd.h> is. I've never tried to use Arduino. I don't think that I can afford the learning curve, now (might have, earlier). If I cannot port it to my hardware, at this point, I see how there is anything to gain by going there.

 

I DID finally get Cliff's sample to compile by regressing to an earlier version of some of the FATfs files. I feel on much more solid ground, now. Sorry for whining about my challenges that I was able to work through. Earlier, they did seem quite insurmountable. Down to 68% capacity on data memory. That is GOOD. 

 

Now, I am off for a little shut-eye, then some board assembly. 

 

It may seem like I am ignoring your carefully stated advice. I'm not, in the long term, at least. At this instant, as just stated, I just don't see how to do what you suggest AND come anywhere close to meeting my schedule. Call it panic - thats a good word at this point. There is an old adage that may apply, here - Better the devil you know than the devil you don't know.

 

I REALLY do appreciate your input.

 

Jim

 

 

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jim,

 

I would be equally worried if I started with Github rather than the Arduino IDE.

 

1.  Have a good night's rest.   

2.  Buy or borrow a UNO and a SD shield.    Download and install the Arduino IDE.

3.  Allocate 4 hours to learn how to upload an example sketch,   run it,   modify it,   save it.

4.  Promise to never look at Github or complex C++ tutorials while you are doing (3)

 

Oh,   if your target pcb has got a ATmega328P,  microSD cage,  6-pin ICSP header,    you already have the hardware that you would get from (2)

You could start running Arduino IDE and sketches right now.    (I guess that you have an AVRISP-2 or USBASP)

 

Life would be far better if you have a 3V USB-UART dongle too.   e.g. http://www.ebay.co.uk/itm/USB-to-TTL-UART-CP2104-Serial-Converter-Module-Improved-CP2102-DTR-pin-UK-Stock-/400784471722?

 

Then you would not even need the AVRISP-2 because the dongle can do the bootloading.

 

However,  a regular USB-UART module is fine too.    I would use it with the AVRISP-2,   because a bootlader without DTR is a pain.   

 

David.

Last Edited: Sat. Oct 18, 2014 - 07:47 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, David -

 

For starters, I did what any modern guy would stupidly do - I Googled Arduino microSD. There were a couple of discussion blogs and that git-hub thing. Lacking any information to the contrary and reading the text on that page, it sounded like THAT was THE Arduino SD library. I had no information until the postings, above, that would lead me to suspect otherwise, being Arduino-illiterate and all. 

 

OK, I'll download the Arduino IDE and see what it shows. Have no AVRISP-2 or USBASP, only JTAGICE mkII and a Dragon. My board has standard 6 pin programming interface. It has USB but I had not intended to install a bootloader. 

 

As before, I really do appreciate your suggestions.

 

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Sat. Oct 18, 2014 - 05:58 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Your Dragon can do the ICSP programming.

A USB-UART would be useful because you can see diagnostic messages on a Terminal.

You still need a 3V power supply.     (or 2 C cells)

 

I understand that you have a microSD on your pcb.

 

Regarding regular Arduinos.    Many shields have a microSD.   e.g.   TFT shields, Ethernet shields,   or even a bare SD shield.    Since regular Arduinos are 5V,    these shields all have level-shifter chips because SDs are 3V.

 

If you are straight 3V in the  first place,    you don't need to f*rt about with level-shifters.

 

Seriously,    whichever hardware Sensors you are intending to use,    there will be Arduino example code.     Mind you,    I understand that you are using a very simple SPI chip.

 

David.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello, David -

 

The PCB has a FT232R working through the UART, an STMicro LS3DSH accelerometer (used in SPI mode), a uSD "card, a Mega328P, an automatic power source switch (TPS2112) and a boost converter (TPS61097) powered from two parallel C-cells. There are several diagnostic LEDs and the whole thing goes into a Bud PN1323 case with a transparent cover (IP-65 rated). 

 

I was planning on diagnostic serial output, especially during development. USB also provides a command input.

 

The whole thing is 3V3 since the accelerometer is 3.3V. I can reference the FT232R interface to 3.3V even though it runs from bus power. Its LDO generates 3V3 for the system when USB is connected.

 

Re: Arduino - I've already shot an hour trying to find Java 5 to run on my Mac for the IDE. Guess I'll do a Win installation on my laptop but that leaves only 3 hours of your "allocated 4". It never takes as little time as it should!

 

Cheers

Jim

 

Until Black Lives Matter, we do not have "All Lives Matter"!

 

 

Last Edited: Sat. Oct 18, 2014 - 08:54 PM