Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Oshonsoft SD Card Problems.

Status
Not open for further replies.

ericgibbs

Well-Known Member
Most Helpful Member
hi,
Are there any members of ETO using the Oshonsoft Basic SD Card IDE compiler.?

To date I have been unable to get any of the following Basic Statements to work.

SDCard32FAT32Exists
SDCardFAT32Dir

The only file names that the compiler will accept have to be part of the Basic program eg: SDCardFAT32FileCreate "hc12file.txt"

Any attempt to 'build' a file name within a subroutine creates a compile error.
I appreciate that a 8.3 file name type is specified in the documentation.

I have found that the Append statement initially takes 50mSec to write a simple 42 byte string. As the size of the file increases, so does the Write time.
As the file size gets to 600Kbytes, the write time for the 42 byte string increases to 620 millisec. !

I did raise this with Vlad sometime ago, the useless reply I got was to 'add more decoupling'.

Before I make a formal complaint to Vladimir, I would like some feedback from other users.

My project uses a 18F4520 , 20mHz xtal.

There is adequate free RAM, ref image

Eric
 

Attachments

  • A01.gif
    A01.gif
    11.7 KB · Views: 326
Hi Eric!!
The SD interface on Oshonsoft is far to incomplete / unreliable for any commercial use, therefore I use MikroE..
I tried.... I mean I really tried... But I didn't get any card to work satisfactory, so I gave up... I haven't used Oshonsoft since.... All my products that used Oshonsoft have been re-written in C...
 
Hi Eric,
Sorry I can't help, but I would also like to use this feature on this PIC.
Does Vlad show any results that he's had?
Camerart.
 
hi C,
The only info I could find were the very basic, Basic examples he posted.
You can choose Block writing , which cannot be read by a SD card reader, or FAT16 , FAT32.

FAT32 requires a PIC with at least 1k of RAM

E
 

Attachments

  • SD extract1.txt
    19.4 KB · Views: 311
Hi Eric,
Blimey! It's not easy is it.
Am I correct that I need one of these: **broken link removed**
connected to the PIC?
C
 
hi,
I use a similar SD PCB, mine has a single row of pins., connected to a 18F4520, 20mHz xtal.

My set up is 'workable' for my project, but not good enough IMO to publish due to the Oshonsoft Basic limitations.
The uncommented code is attached for your 'look see' of what is required.

The plot is via HC12 transceiver, for ref only.
E

Sample of SD record:

hc12file.txt 07-08-16
A,+18.0,97.5,4.955,09.64,010111,+25.7,08:05:35
A,+18.0,97.6,4.960,09.64,010111,+26.0,08:06:38
A,+18.0,97.5,4.960,09.64,010111,+26.0,08:07:40
A,+18.1,97.5,4.960,09.64,010111,+25.7,08:08:43
A,+18.1,97.3,4.960,09.64,010111,+25.7,08:09:46
A,+18.1,97.3,4.960,09.64,010111,+25.7,08:10:48
A,+18.1,97.4,4.960,09.64,010111,+25.7,08:11:51
A,+18.1,97.3,4.960,09.64,010111,+25.7,08:12:54
A,+18.1,97.3,4.960,09.64,010111,+25.7,08:13:56
A,+18.1,97.3,4.960,09.64,010111,+25.7,08:14:59
A,+18.1,97.6,4.960,09.64,010111,+25.7,08:16:02
A,+18.1,97.5,4.960,09.64,010111,+25.7,08:17:04
A,+18.2,97.3,4.960,09.64,010111,+25.7,08:18:07
A,+18.2,97.3,4.960,09.64,010111,+25.7,08:19:10
A,+18.2,97.0,4.960,09.64,010111,+25.7,08:20:12
A,+18.2,97.1,4.960,09.64,010111,+25.7,08:21:15
A,+18.3,97.3,4.960,09.64,010111,+25.7,08:22:18
A,+18.3,97.1,4.960,09.64,010111,+25.7,08:23:20
A,+18.3,96.9,4.960,09.64,010111,+25.7,08:24:23
A,+18.3,97.1,4.960,09.64,010111,+25.7,08:25:26
 

Attachments

  • A04.gif
    A04.gif
    20.8 KB · Views: 319
  • 18F4520_SD1.txt
    19.5 KB · Views: 314
Hi Eric,
I tried the examples that you posted, and they all appear to compile, and run.
This is advanced for me, but if you can give me an example of a program that won't work for you, then I can try to see if I can get it to work with my 'simple' approach. Sorry, but it's the best I can do with my limitations:(
C.
 
Hi Eric,
I've now received my SD card readers, can you post a program showing a problem, so I can play with it please?
C
 
hi C,
I have already posted a working program. Post #6
The problems I have 'by passed' are Filename building in a subroutine , FileExists, Directory do not work for me.

E
 
hi C,
This is my rough drawing of the 18F4520 circuit for that program, it may help.

I use a RS232 to USB converter for RS232 TXD/RXD data

Pins PORTB,5,6,7 and /MCLR are connected to my in circuit programmer.

E
 

Attachments

  • 18F4520_SD_RTC_DHTa.png
    18F4520_SD_RTC_DHTa.png
    82.7 KB · Views: 324
Last edited:
Hi E,
Thanks for the drawing.
Can you post programs showing, Filename building in a subroutine , FileExists, Directory, not working please?
C.
 
Hi E,
Thanks for the drawing.
Can you post programs showing, Filename building in a subroutine , FileExists, Directory, not working please?
C.

hi C,
You will have to write your own, I don't keep copies of programs that don't work.;)

Post any you write that work or not and I will give them a try.

E

EDIT: I have this fragment

init_card:
SDCardInit
SDCardFAT32Init
del = 0
wt1: If sd_fat32_status.sd_fat32_error = 0 Then
Hserout "FAT32 initialised!", CrLf
errflg = 0
Goto c1
Else
WaitMs 10
del = del + 1
If del > 100 Then Goto wt1
Hserout "FAT32 Init failed!", CrLf
errflg = 1
Endif
c1:
Return

create_file:
Gosub init_card
If errflg = 1 Then Return

Hserout "Checking File Exists", CrLf

SDCardFAT32FileExists "filenum1.txt" ;It locks up here in a PIC.
If sd_fat32_status.sd_fat32_notfound = 1 Then
WaitMs 200
SDCardFAT32FileCreate "filenum1.txt"
del = 0
wt2: If sd_fat32_status.sd_fat32_wr_opened = 1 Then
Hserout "filenum1.txt created!", CrLf
Goto sk1
WaitMs 10
del = del + 1
If del < 100 Then Goto wt2
Endif
Else
Hserout "filenum1.txt Exists!", CrLf
Endif
 
Last edited:
hi C,
You will have to write your own, I don't keep copies of programs that don't work.;)

Post any you write that work or not and I will give them a try.

E
Hi E,
Ok, but don't hold your breath:)
If you do write none working ones, please post them to give me an idea how they look.
C.
 
Hi Eric,
Had a thought! In #4 you mention block writing which may be what my thought was about?
I recall that when editing lines on a ZX Spectrum, we had to pass through every digit one at a time, which sometimes took ages. When it wrote the image one the screen, it was in four sections, I presume for speed.
I'm not sure if this is anything to do with the problem you are having, but if you divided the memory down to small sections and wrote files across a number of sections, would this speed things up?
C.
 
hi C,
Thanks for the info.
In the Oshonsoft IDE there are two methods of using SD cards.
1.
Writing/Reading 'raw' data bytes in Blocks of 512, this works OK, but the downside is that it cannot be Read by a regular SD card reader into a PC.
You have to download them into a PC using RS232, even at 57600 Baud, downloading a multi gigabyte file takes forever.!

2.
Using FAT32, which is compatible with Windows and PC card readers.

I have the FAT32 method working OK after much fiddling, mainly ignoring the so called examples in the O/S manual.

As I have posted before, some of the manual commands do not work at all, so I have a work around.

Eric
 
I have the FAT32 method working OK after much fiddling, mainly ignoring the so called examples in the O/S manual.

Hi Eric,
Is this a new development? If so good.

We know there are problems with Oshonsoft, but I do a lot of searching for my projects, and notice similar problems with other systems. I read on the Picaxe site, that one was moving because of it's failings, and another who moved from BASIC because a of a similar thing. If I were to start from here, I'm not sure which system I would use. I've had a lot of fun with the Oshonsoft system, and 'met' some interesting people:)
C.
 
Hi Eric,
I'm sure you're fully aware, but I was just reading about SPI pull-ups, and there was a note in the same thread, stating that for SD cards, all pins should have pull-ups.
C.
 
Hi Eric,
I'm sure you're fully aware, but I was just reading about SPI pull-ups, and there was a note in the same thread, stating that for SD cards, all pins should have pull-ups.
C.
hi C,
They do have pull ups on the SD Card PCB.
The operation of the hardware is not a problem, its the 'unfit for purpose', Oshonsoft SD IDE compiler, which should never have been released, which is the problem.

As I have said before, I have built/tested and I am using a working data logger, using 'work arounds', that meets my requirements.

I was hoping to post as an Article a full blown logger project, showing all the SD features, but IMHO the project is only fit for 'in house' use.:(

Eric
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top