Sample of Matt for SD with fat 32 and problem with hex file

33 views
Skip to first unread message

Zet Weeh

unread,
Sep 15, 2022, 5:40:14 AM9/15/22
to jallib
Hi everybody

I have a picture in hex that is working fine on an oled.
I want to use it on a sd-card that's build in ILI9341.
When I use the sample of Matt I can write and read all of the sample; so it's 
working fine.
The hex file is 500 bytes so one cluster.
When I want to write and read the hex to the SD I can see in RealTerm
that the writing is going fine till byte 400 and then it becomes a mesh.
I changed the baudrate but that did not help. Has anybody a suggestion what is going wrong and what to do?
Peter

Rob CJ

unread,
Sep 17, 2022, 11:37:51 AM9/17/22
to jal...@googlegroups.com
Hi Peter,

I do not have enough information to answer your question. Which serial library are you using? Do you have a delay in writing to the  serial interface since the SD card will be much faster than the serial interface and it might be that your computer is not able to keep up with it.

Kind regards,

Rob




Van: jal...@googlegroups.com <jal...@googlegroups.com> namens Zet Weeh <zet....@gmail.com>
Verzonden: donderdag 15 september 2022 11:40
Aan: jallib <jal...@googlegroups.com>
Onderwerp: [jallib] Sample of Matt for SD with fat 32 and problem with hex file
 
--
You received this message because you are subscribed to the Google Groups "jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallib+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/21e71303-1a48-4696-95fb-cb227a8ffcaen%40googlegroups.com.

ZetWeeh

unread,
Sep 18, 2022, 11:27:05 AM9/18/22
to jal...@googlegroups.com

Hi Rob

 

Thanks for your answer.

I use serial software with baudrate 115200. This is only for seeing what is happening.

Writing to the SD card is by SPI.

I use this code:

;sd_start_write(30)          --get sd card ready for write at sector 30

;    for count(molen) using teller loop

;        sd_data_byte = molen[teller]

 

;        format_dword_dec(serial_sw_data,teller,3,0)

;        print_string(serial_data, " ")

;        gegeven = molen[teller]

;        print_byte_hex(serial_sw_data,gegeven)

;       print_string(serial_data, "    ")

 

;    end loop

;sd_stop_write

 

The cursief part I made when I saw the problem by reading  the SD card.

So without the cursief part I noticed the problem.

I too read the file on the SD card in Windows to be sure where was the problem.

When I copy the file to the SD card in Windows: it works fine.

I suppose the delay is coming after

 

sd_data_byte = molen[teller]

 

but how long?

 

Kind regards,

Peter

 

Verzonden vanuit Mail voor Windows

 

Van: Rob CJ
Verzonden: zaterdag 17 september 2022 17:37
Aan: jal...@googlegroups.com
Onderwerp: Re: [jallib] Sample of Matt for SD with fat 32 and problem with hex file

 

Hi Peter,

 

I do not have enough information to answer your question. Which serial library are you using? Do you have a delay in writing to the  serial interface since the SD card will be much faster than the serial interface and it might be that your computer is not able to keep up with it.

 

Kind regards,

 

Rob

 

 

 

Van: jal...@googlegroups.com <jal...@googlegroups.com> namens Zet Weeh <zet....@gmail.com>
Verzonden: donderdag 15 september 2022 11:40
Aan: jallib <jal...@googlegroups.com>
Onderwerp: [jallib] Sample of Matt for SD with fat 32 and problem with hex file

 

Hi everybody

 

I have a picture in hex that is working fine on an oled.

I want to use it on a sd-card that's build in ILI9341.

When I use the sample of Matt I can write and read all of the sample; so it's 

working fine.

The hex file is 500 bytes so one cluster.

When I want to write and read the hex to the SD I can see in RealTerm

that the writing is going fine till byte 400 and then it becomes a mesh.

I changed the baudrate but that did not help. Has anybody a suggestion what is going wrong and what to do?

Peter

 

--
You received this message because you are subscribed to the Google Groups "jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallib+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/21e71303-1a48-4696-95fb-cb227a8ffcaen%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "jallib" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jallib+un...@googlegroups.com.

Rob CJ

unread,
Sep 19, 2022, 1:54:58 PM9/19/22
to jal...@googlegroups.com
Hi Peter,

I still have a problem understanding your problem but I am not an SD card expert and do not know is you need delays for writing to an SD card. Could be but maybe Matt knows.

I also see you are using two serial ports, is that right? That should not be a problem but I was just wondering if that was on purpose.

Kind regards,

Rob


Verzonden: zondag 18 september 2022 17:26
Aan: jal...@googlegroups.com <jal...@googlegroups.com>
Onderwerp: RE: [jallib] Sample of Matt for SD with fat 32 and problem with hex file
 

Matthew Schinkel

unread,
Sep 19, 2022, 8:20:42 PM9/19/22
to jallib
Hi Peter, please send us your full sample file so we can try it and find the problem.

I don't know if your variable teller and molen[] are defined as a byte or a word. Also if array molen isn't large enough you will get wrong information. Since we don't have this information it is hard for us to find the problem.

I see you are writing to the sd card with  sd_start_write to sector 30. You won't be able to read the file from windows unless you want to use fat32. If you don't want to read the data into windows you don't need fat32 so you can continue with what your using.

Old sd cards do need a delay. If you are using an old sd card smaller than 4gb you can turn this on before "include sd_card":
const bit SD_DELAY_AFTER_WRITE = TRUE

Matt.

Reply all
Reply to author
Forward
0 new messages