SD Cards anyone?

Anything not specifically related to NBTV, but at least of some technical nature that might be of interest to NBTV members. Items for sale and links to retailers do not belong here.

Moderators: Dave Moll, Steve Anderson

Postby Steve Anderson » Wed Feb 01, 2012 10:35 pm

Thanks Graham,

It's been a frustrating journey, often because of my my own crass errors, but just like British Rail, I'm getting there.

One can understand a manufacturer, say Canon (digital cameras) throwing a bunch of engineers at this, sorting out the problems and then saying nothing to anyone. Not even to the SD Card Association. Such that their competitors have to go through the same exercise (read expense).

So the SD Card Association have no feedback that their specification is woefully lacking...which it really is IMHO.

For what I'm doing I've cracked all the necessary items SD-Card wise for reading, all I'm doing now is tidying up my own software. Next comes writing and handling the FAT32 system. I'm hoping that the cards won't be the issue anymore and the write commands are in the same format and have the same constraints as reading. We will see.

Steve A.
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5360
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

Postby gary » Thu Feb 02, 2012 12:24 am

Steve Anderson wrote:but just like British Rail, I'm getting there.


So what's your cooking like Steve? ;-)
gary
 

Postby M3DVQ » Thu Feb 02, 2012 10:23 am

Are you writing C or pure assembler?

If C you could cheat and port http://elm-chan.org/fsw/ff/00index_e.html to your device. :)

Though I may be missing the point and the whole challenge of writing your own is the main purpose. :roll:
M3DVQ
Just nod and pretend you understand me
 
Posts: 338
Joined: Sat Feb 10, 2007 10:52 am
Location: Lincolnshire

Postby gary » Thu Feb 02, 2012 10:36 am

oooo that's a nice library - now where's my old Z80?... ;-)

Thanks for that link.
gary
 

Postby M3DVQ » Thu Feb 02, 2012 11:50 am

gary wrote:oooo that's a nice library - now where's my old Z80?... ;-)


If you get something working implementing FAT on a Z80 then you can do the filesystem driver for the ZX Spectrum software I'm (procrastinating instead of) writing :wink:
M3DVQ
Just nod and pretend you understand me
 
Posts: 338
Joined: Sat Feb 10, 2007 10:52 am
Location: Lincolnshire

Postby gary » Thu Feb 02, 2012 12:14 pm

Yeah, I procrastinate too, but I am going to stop doing that someday...
gary
 

Postby Steve Anderson » Thu Feb 02, 2012 3:27 pm

...my cooking? I like to think better than you'll ever get from BR. I actually do cook for the family once a week just to have a break from continuous Thai Fare. It gives them a taste of western food that they're unlikely to get otherwise. Rice three times a day does get to you after a while...anyway I digress (again)...

I'm writing this in assembler mainly because many years ago there was no 'C' and I really can't be bothered learning another language however easier it may be. Plus for other applications I may well need the speed afforded by this approach.

I did look at that 'elm' site and it was a reasonable reference, but as I have mentioned before there are omissions and assumptions made, and not only on that site but without exception all the others I have visited.

I can't see any reason why a Z80 couldn't talk to a SD Card (or any other variety), you'd have to bit-bang the SPI interface but that's not an impossible task. If I were to choose a classic micro it would be Motorola's MC6809 which I used to write code for in the mid-80s. Since those days up until recent times I haven't written any code for anything, it's been a case of re-learning things I had largely forgotten.

There is a local company that still has stocks of both the 6809 and the Z80 at moderate prices, around six quid for a 6809. I have been tempted but it's all the external stuff you need to add that has put me off. External program memory, external RAM, external UART and so on... There's also the speed issue, the basic 6809 was a 1MHz device, the 68B09 was 4MHz (working from my own memory), this thing rips along at over 12mips and that's not flat-out.

All this and a whole lot more is internal to the PICs, except the internal RAM, my greatest criticism which is generally 4k or less. The device I'm using only has 1.5k of RAM. In a lot of applications including this one that's more than enough. But if you need to process or manipulate several frames of NBTV you have to add additional external RAM which potentially only serves to slow the whole process down.

But if you need that sledgehammer to crack that nut you might as well use a PC which is entirely sane, but I would like this to be self-sufficient and run for weeks on batteries. Not really applicable to NBTV usage, I have other applications (products) where it would be.

Steve A.

Later...I will add that this is destined for an NBTV application which is where the speed will be needed, if it were just to be a data-logger that would be of no issue.

I used to have Alzheimer's, but I've forgotten all about it.
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5360
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

Postby M3DVQ » Fri Feb 03, 2012 6:32 am

Steve Anderson wrote:I can't see any reason why a Z80 couldn't talk to a SD Card (or any other variety), you'd have to bit-bang the SPI interface but that's not an impossible task


In fact there's already hardware and software for the Spectrum to do it, though that doesn't implement a FAT filesystem.

Personally I'm much more comfortable with Parallel ATA. Uses lots of pins but the spec is so much easier to read ;)
M3DVQ
Just nod and pretend you understand me
 
Posts: 338
Joined: Sat Feb 10, 2007 10:52 am
Location: Lincolnshire

Postby gary » Fri Feb 03, 2012 9:29 am

Steve Anderson wrote:I'm writing this in assembler mainly because many years ago there was no 'C'


Ok, Methuselah, my, very well thumbed, copy of K&R was purchased circa 1979, C itself has been available from the early 70s, so perhaps that should read "many many years ago"? ;-)

I will concede, however, finding a compiler with *any* specific target device may have been problematical, but of course you could have whipped one up yourself with a few months work... ;-)
gary
 

Postby Steve Anderson » Fri Feb 03, 2012 3:31 pm

M3DVQ wrote:Personally I'm much more comfortable with Parallel ATA. Uses lots of pins but the spec is so much easier to read ;)


I do tend to agree, the 40 pins (less one) doesn't put me off nor do the commands which as you say are somewhat simpler. What does is the size, weight and primarily the power consumption of a hard-drive...assuming that's what you were inferring.

The closest thing would be a CF card which basically mimics a hard-drive, but 50 of those tiny pins did put me off. I guess you can get adapters to a 0.1" arrangement but although my camera uses CF cards I've got quite a few SD cards and it just seemed to make sense to use them. It seems that without any hardware or software modification (except the socket or using an adapter), it should work equally well with Mini-SD and Micro-SD cards, at least in this simple mode.

Not having used a Spectrum I didn't know it had an SPI interface. Here I'm starting from zero and trying to minimize the number of chips required. The 40-pin device has most of its ports unused, I plan to replace it with a 'reduced' version when my supplier here can be bothered to get some.

Gary, I didn't realize that 'C' had been around so long, if it had been brought to my attention in the 80s I may have used it. Now...I really can't be bothered.

An assembler or compiler for these classic micros is a stumbling block. There are free assemblers for the 6809, I assume also for the Z80. Crossware still make cross-assemblers for these devices, but they're not cheap.

I do have an assembler for the 6809 from SB-Projects (AS09, a free download) but I have not fired it up. It's there if one day I decide to go that route...to be honest, unlikely.

Steve A.
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5360
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

Postby gary » Fri Feb 03, 2012 4:26 pm

Steve Anderson wrote:Gary, I didn't realize that 'C' had been around so long


LOL, Steve, don't get me wrong, having written thousands of lines of assembly, and peeked and poked almost as much machine code, I am not, necessarily, promoting it's use in your project, although there are actually many good reasons for doing so - 'C' is the closest to assembly of all the main stream high level languages - keep in mind it was specifically written as a "system level" language and so is ideal for writing random access device drivers etc.

It's just that, having used the language for over 30 years (and it's supersets), I am quick to jump to it's defence, and I can also use it as an excuse for a dig at Graham at the same time... ;-) (I'm sure he'll be reading this thread). ;-)
gary
 

Postby Steve Anderson » Fri Feb 03, 2012 4:54 pm

gary wrote:...I am quick to jump to it's defence...


No defence needed, it's the choice of many and I do see the sanity in using it, its popularity speaks volumes. But unless there's a compelling reason (i.e. someone pays for me to learn it) I'll stay with what currently works for me. Indeed, your 30 years of using 'C' is testament enough.

Just a quick check on the Crossware site, the assembler for a 6809 or Z80 are both 365 quid each. They don't say if that includes VAT or shipping....yikes!!

Steve A.
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5360
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

Postby gary » Fri Feb 03, 2012 5:10 pm

Steve Anderson wrote:
gary wrote:Just a quick check on the Crossware site, the assembler for a 6809 or Z80 are both 365 quid each. They don't say if that includes VAT or shipping....yikes!!

Steve A.


Well, you can generally pay as high as you want for an assembler (or compiler etc) but what you are generally paying for is support (and a reasonable expectation of performance). I would be surprised if there weren't free, open source, assemblers for those devices out there somewhere. In fact, normally, the manufacturers of the devices provide free (or cheap) assemblers for their instruction sets.

PS: I couldn't imaging paying 365 quid for *any* assembler unless it included a comprehensive development board along with it.
gary
 

Postby Steve Anderson » Fri Feb 03, 2012 6:04 pm

gary wrote:..I couldn't imaging paying 365 quid for *any* assembler unless it included a comprehensive development board along with it.


Nope, it's one CD and a printed manual in a box...that's it. Although it may take me back close on 30 years I would expect a time machine for that price. I doubt they sell many, but who knows?

Compare that to using Microchips products, the software is free (downloadable), updated when they release new devices and a total development package. All you have to supply is the programmer.

There are a number of free software programmers on the 'net, you have to provide/build the hardware for this and that's how I started out. But it means building a new programmer almost for every device variant you may use. Then once these 'free' software programmers become established you have to start paying for the updates when new devices are launched.

So I lashed out and bought the real deal Microchip PICkit 3 programmer/de-bugger which of course it's in their interest to always keep updated and the software free of charge. I believe Atmel and others do the same. The interface is USB rather than a LPT or serial port. It also came with a very small development/demonstration board, of not much use, but it did allow you to confirm all was well with your Microchip software installation and your hardware.

It also came with a CD containing the IDE software, but the version on their web-site is more recent. Also all their tutorials. I know this may sound like a commercial for them, it's not intended to be, I'm just one happy bunny.

Steve A.
User avatar
Steve Anderson
"Fester! Don't do that to 'Thing'"
 
Posts: 5360
Joined: Fri Mar 30, 2007 10:54 pm
Location: Bangkok, Thailand

Postby gary » Fri Feb 03, 2012 7:05 pm

Sure Steve, although that Crossware software is a little more than just an assembler, it's a full IDE with libraries etc. Still, it's more than I would be prepared to pay especially as there are plenty of free assemblers and IDE's for the same devices...
gary
 

PreviousNext

Return to Off Topic

Who is online

Users browsing this forum: No registered users and 29 guests

cron