Register

Casio fx-9860G SD- How to read files in the sd card?

Discuss anything related to calculators. For specific help on certain games/programs check the Released Projects subforum.
Senior Member
Posts: 116
Joined: Mon Mar 02, 2015 10:53 am
Calculators: Casio fx-CG20

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby AmazoNKA » Thu Aug 18, 2016 11:10 pm

I'm back tomorrow in case you wish any info on my openlog.

Also made some progress on my pokemon go addin but have small questions I will post in another post if you don't mind looking at them too please

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby SimonLothar » Sun Aug 21, 2016 1:49 pm

With SH-4-based calculators, I noticed no problems up to now.
At present I am working on the behaviour of the OpenLog, when it is connected to a SH-3-based calculator. This seems to be a problem.
I observe inexplicable data losses.
The baud rate is not the problem, as I supposed earlier.
To eliminate the possibility of borderline signal-level difficulties, I even inserted a 74LS04 between OpenLog and calculator for TTL-signal-conditioning. No success.
I looks as if the problem is located in the vicinity of the serial module's FIFO in combination with the serial interrupt handler.
So next I will try to bypass the serial interrupt handler. After that I will get short of ideas.
I'll be back!

Senior Member
Posts: 116
Joined: Mon Mar 02, 2015 10:53 am
Calculators: Casio fx-CG20

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby AmazoNKA » Fri Aug 26, 2016 12:45 am

Do you think those problems will be bugging us with the new openlog firmware too?

Slightly unconnected project i looked at some time ago was QR generation on prizm (but for testing started it in Visual Basic to begin with just to understand casio classwiz integration on fx-991ex series first and to see what other platforms I could convert from casio runmat memory entries to url queries via qr allowwing wolfram alpha and other online calculators) but the reason I mention QR here is because they by design integrate correction mechanism so i wonder if the same thing can help with the problem faced with unreliable data transmission here?

Or maybe you know even better transmission protocols - i have not researched those well enough to know how suitable they would be for serial communication on our Casios

I'm quite close to releasing my pokemon add-in so will try to get more time for the openlog project next. Thanks again for all your great work and analysis

Senior Member
Posts: 116
Joined: Mon Mar 02, 2015 10:53 am
Calculators: Casio fx-CG20

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby AmazoNKA » Wed Aug 31, 2016 11:37 pm

I have been looking at this project for a couple of days now and wanted to check a few things:

is data loss you are experiencing only for writing data to sd please? or also for reading from SD?

have you tried introducing any delay between writes? is something as on the following post of any use: https://github.com/sparkfun/OpenLog/wik ... us-Logging which also refers to this https://github.com/sparkfun/OpenLog/issues/62
Also same github history lists constant improvement to writing speeds... i have not investigated yet how difficult firmware updating or modification is so wonder if you tried updating the firmware please

finally i attempted over the last couple of days to compile your sparkfun C++ sources - do i need minisdk and some extra steps for c++ enabled please and will it work on windows 10 please?

regarding interface i may have mentioned already I will try to make it as close to native OS apps like memory or link etc as possible - and will ask gbl08ma if he wishes to consider incorporating sd interaction into his file manager in utilities addin... i would try it myself if I could make his addins compile on windows

i'm looking forward to hearing if you succeeded with bypassing the serial interrupt handler or other ideas.

kind wishes

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby SimonLothar » Fri Sep 02, 2016 9:49 pm

AmazoNKA wrote:is data loss you are experiencing only for writing data to sd please? or also for reading from SD?
No, up tp now I investigated the read (type 3) function, only. I let a 1552 byte file read repeatedly (1000 times) and checked the byte sum.
I observed a loss probability of about 1 %, even on SH-4-based calculators.

AmazoNKA wrote:have you tried introducing any delay between writes? is something as on the following post of any use: https://github.com/sparkfun/OpenLog/wik ... us-Logging which also refers to this https://github.com/sparkfun/OpenLog/issues/62
Also same github history lists constant improvement to writing speeds... i have not investigated yet how difficult firmware updating or modification is so wonder if you tried updating the firmware please
If I understood the documentation right, you need some arduino board to do a firmware update. I don't want to go this far. Before we can answer further questions, we have to wait, whether you experience the data losses with your sparkfun, too. If the losses occur on your system, we would have to implement kinda CRC. If not, I have to inspect my hardware.

AmazoNKA wrote:finally i attempted over the last couple of days to compile your sparkfun C++ sources - do i need minisdk and some extra steps for c++ enabled please and will it work on windows 10 please?
To enable c++ with the old SDK it is sufficient to rename the file extensions of the sources to .cpp. My sparkfun C++ sources contain a few parts, which depend on the mini-SDK. These parts are intended to display some results for debugging. I try to separate them and introduce a specialized class. The serial function parts should work with other SDKs.

AmazoNKA wrote:i'm looking forward to hearing if you succeeded with bypassing the serial interrupt handler or other ideas.
I tried this idea. It seems to be too slow. But meanwhile I do not think, that this would solve the problem.
I'll be back!

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby SimonLothar » Sat Sep 03, 2016 9:06 am

I am still searching for reasons of the data losses.
As I already eliminated the uncertainty of signel level strength by inserting a 74LS04, I now measured the span of ten bits (one byte) on both lines (Fluke 99 scopemeter series II).
The calculator gives constantly 86.8 µs. The embedded serial module is very reliable.
The sparkfun results vary. Mean: 86.3 µs; SDev 1 µs (87.6; 87.2; 87.2; 85.2; 85.2; 86.4; 86.4; 85.2; 87.6; 85.2).
The sparkfun bit-stream is generated by software. That is possibly the problem.

One solution would be to transfer a file in blocks with a crc or a checksum.
I'd prefer 512 byte blocks with a two-byte checksum.
The performance would be degraded due to the error prevention. Especially when writing a file. In this case the file has to be re-read to verify the checksums.
This makes things more complicated.
I'll be back!

PostThis post was deleted by SimonLothar on Sat Sep 03, 2016 4:37 pm.

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby SimonLothar » Sat Sep 03, 2016 5:38 pm

The write function I use at present is "append file", which enters the logmode! After every 514 byte block, the sparkfun needs a 100 ms delay to store the data to the sd-card.
Without a proper delay, the sparkfun's serial receive buffer will brim over (f. i. 50 ms are not sufficient).
Before sending the escape sequence to close the file and terminate the logmode, a 100 ms delay is necessary, too.
With firmware version 3.3 the escape sequence is written to the file, too.
When using the "append file"-function, the escape sequence mustn't occur in the data stream. Therefore \x1A has to be padded.

Apart from the characteristics mentioned above, there seem to be no further problems with writing.
I'll be back!

Senior Member
Posts: 116
Joined: Mon Mar 02, 2015 10:53 am
Calculators: Casio fx-CG20

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby AmazoNKA » Sat Sep 03, 2016 7:09 pm

Could it be something to do with the speed class of the microsd card?

Does the 100ms delay solve the missed data problem? What will be realistic speed of copying data from sd to storage memory please - much worse than the current speed of saving main memory to storage memory using your insight add-in?

Have you incorporated you logging etc tests into insight or any other add-in you could kindly share with me in compiled form - i hope to have the soldering done on Monday so could run the test for you to see if my firmware gives better results.

Finally is it possible please to power the module from mini usb port of the calculator itself - I doubt it as it seems to be a slave port but maybe you know - i will of course re-read your soldering instructions just in case too

Thanks for everything again

Senior Member
User avatar
Posts: 605
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750GII, Casio fx-9750GII (SH4), Casio fx-9860G, Casio fx-9860G SD, Casio fx-9860G Slim, Casio fx-9860GII SD, Casio fx-9860GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG20, Casio fx-CG50, Casio Classpad fx-CP400

Re: Casio fx-9860G SD- How to read files in the sd card?

Postby SimonLothar » Sat Sep 03, 2016 9:59 pm

AmazoNKA wrote:Could it be something to do with the speed class of the microsd card?
At present I use a 4 GB class 4 card. I tried two fast 64 GB UHS-1 cards, but both were not recognized by the sparkfun.
AmazoNKA wrote:Does the 100ms delay solve the missed data problem?
No, I believe, that the read-misses are caused by the sparkfun's unstable bit-span and cannot be avoided. I use a checksum to detect the misses a do a retry in case.
AmazoNKA wrote:What will be realistic speed of copying data from sd to storage memory please - much worse than the current speed of saving main memory to storage memory using your insight add-in?
Reading a 200000 byte file in 514 byte blocks including the checksum-verify takes about 25 s. Writing this file takes 25 s, too. I replaced the fixed 100 ms delay per 514 byte block by a waiting loop, which waits for the transmit buffer to be empty. That doubled the speed.
AmazoNKA wrote:Have you incorporated you logging etc tests into insight or any other add-in you could kindly share with me in compiled form - i hope to have the soldering done on Monday so could run the test for you to see if my firmware gives better results.
I will upload INSIGHT.G3A as fast as possible.
AmazoNKA wrote:Finally is it possible please to power the module from mini usb port of the calculator itself - I doubt it as it seems to be a slave port but maybe you know - i will of course re-read your soldering instructions just in case too
The battery voltage is not reachable via the calculator's USB-connector.
I'll be back!

PreviousNext

Return to General

Who is online

Users browsing this forum: No registered users and 51 guests