Register

Transfer Files from Arduino to Casio-FX-CG20

Discuss issues related to Calculator Hacking/Modding.
Junior Member
Posts: 16
Joined: Tue Apr 10, 2018 10:55 pm
Calculators: Casio fx-CG 20

Re: Transfer Files from Arduino to Casio-FX-CG20

Postby randomrguy » Sat Apr 21, 2018 10:43 pm

Im trying to send files with my kinda working program now and its fine for simple text files, but i cant transfer images(error message on casio while sending data, or just 0 size of the image file in casio). My question is, does:

"Bytes in the range 0x00 ->0x1F can not occur in the D field. Bytes with those values must be offset by 0x20 and prefixed with a 0x5C ('\') byte. E.g. 0x0A (LF) becomes 0x5C2A. Any 0x5C bytes alone must be sent as 0x5C5C."

apply to raw data from file transfers? And if it does, how should i send the data/offset the bytes? At the moment im storing the bytes of the input file in a String and send the Sring as Data similar to that:
String data = "";
data+=(char)file.read();
... send data String in package

Im not sure if that's the right way to send the File data as chars and how to offset the bytes.

Senior Member
User avatar
Posts: 604
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750 G II, Casio fx-9750 G II (SH4), Casio fx-9860G, Casio fx-9860 G SD, Casio fx-9860G Slim, Casio fx-9860 GII SD, Casio fx-9860 GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG 20, Casio Classpad fx-cp400, Casio fx-CG 50

Re: Transfer Files from Arduino to Casio-FX-CG20

Postby SimonLothar » Sun Apr 22, 2018 2:36 pm

I must admit, that I am at a loss here.
If rx/tx-wires are not connected correctly, you shouldn't get any reaction at all.
After you have sent the 0x45-command, do you wait for the ack-packet (without sending any other byte)?
Perhaps you should post a complete dump of bytes, which are sent and received. Please show them in hex (t. i. C0 and not 192).
I'll be back!

Junior Member
Posts: 16
Joined: Tue Apr 10, 2018 10:55 pm
Calculators: Casio fx-CG 20

Re: Transfer Files from Arduino to Casio-FX-CG20

Postby randomrguy » Sun Apr 22, 2018 6:38 pm

.
Last edited by randomrguy on Wed Apr 25, 2018 4:30 pm, edited 1 time in total.

Junior Member
Posts: 16
Joined: Tue Apr 10, 2018 10:55 pm
Calculators: Casio fx-CG 20

Re: Transfer Files from Arduino to Casio-FX-CG20

Postby randomrguy » Mon Apr 23, 2018 8:40 pm

Also its not that important for me if the casio is responsing, or not. Much more important for me is, that i can get file transfers with images to work the same as text files.

Junior Member
Posts: 16
Joined: Tue Apr 10, 2018 10:55 pm
Calculators: Casio fx-CG 20

Re: Transfer Files from Arduino to Casio-FX-CG20

Postby randomrguy » Wed Apr 25, 2018 4:25 pm

The problem was my casio. I bought a new one and now it's working like it should. The only kinda weird problem im still getting is:
When transfering large Images, im getting an error package after around 120 data packages(i think its the last Data package).
0x15 01 0 6F//i've read in your pdf that its an resend request, but how should i response to that?
When i now send the data package again, im getting spammed with the same error package over and over again.
Do i somehow have to acknowledge that, or do i have to send the whole file again?

Also for all Files after the first File im getting send 0x15 04 0 6C the overwrite impossible error packet back to me. How should i react to that and do i need to send some command after the data packages for one file to signalize that this file is done and a new one begins? At the moment im just sending the file command again and then im sending the data.

Also is it correct to shift the data bytes of the file with values between 0x00 and 0x1F and prefix them with 0x5C, therefor sending less data in the package(maximum 256 bytes), or should i send the same amount of data with the additional prefixes, so the total data in the package could be up to 512 bytes?

Senior Member
User avatar
Posts: 604
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750 G II, Casio fx-9750 G II (SH4), Casio fx-9860G, Casio fx-9860 G SD, Casio fx-9860G Slim, Casio fx-9860 GII SD, Casio fx-9860 GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG 20, Casio Classpad fx-cp400, Casio fx-CG 50

Re: Transfer Files from Arduino to Casio-FX-CG20

Postby SimonLothar » Thu Apr 26, 2018 4:45 am

randomrguy wrote:The problem was my casio. I bought a new one and now it's working like it should. The only kinda weird problem im still getting is:
When transfering large Images, im getting an error package after around 120 data packages(i think its the last Data package).
0x15 01 0 6F//i've read in your pdf that its an resend request, but how should i response to that?
When i now send the data package again, im getting spammed with the same error package over and over again.
Do i somehow have to acknowledge that, or do i have to send the whole file again?
If the hardware works well, the most probable cause for that error is a checksum-problem. Or perhaps a byte between 0x00 and 0x1F, which has not been escaped.

randomrguy wrote:Also is it correct to shift the data bytes of the file with values between 0x00 and 0x1F and prefix them with 0x5C, therefor sending less data in the package(maximum 256 bytes), or should i send the same amount of data with the additional prefixes, so the total data in the package could be up to 512 bytes?
You can send 256 bytes of original data. The amount of bytes including the escaped ones may be up to 512 bytes.
I'll be back!

Senior Member
User avatar
Posts: 604
Joined: Sat Sep 15, 2012 6:59 am
Location: Krautland ****
Calculators: Casio fx-7400GII, Casio fx-7400GII (SH4), Casio fx-9750 G II, Casio fx-9750 G II (SH4), Casio fx-9860G, Casio fx-9860 G SD, Casio fx-9860G Slim, Casio fx-9860 GII SD, Casio fx-9860 GII SD Power Graphic 2, Casio Classpad 330 plus, Casio fx-CG 20, Casio Classpad fx-cp400, Casio fx-CG 50

Re: Transfer Files from Arduino to Casio-FX-CG20

Postby SimonLothar » Thu Apr 26, 2018 5:19 am

randomrguy wrote:Also for all Files after the first File im getting send 0x15 04 0 6C the overwrite impossible error packet back to me. How should i react to that and do i need to send some command after the data packages for one file to signalize that this file is done and a new one begins? At the moment im just sending the file command again and then im sending the data.
I noticed, that you set the over-member (OW) of your command-packet to 0x01 when sending the 0x45-command. OW==0x01 is intended to reject an overwrite. Did you try to set OW to 0x02 (force overwrite)?
I'll be back!

Junior Member
Posts: 16
Joined: Tue Apr 10, 2018 10:55 pm
Calculators: Casio fx-CG 20

Re: Transfer Files from Arduino to Casio-FX-CG20

Postby randomrguy » Thu Apr 26, 2018 4:36 pm

Ok, thank you very much for your help! Im gonna change and check some things in the code today and then i'll update the code of the forum post. Atleast im getting somewhere now! :)

But do i have to only send the one packet of the data again as an answere to the resend request(0x15 01 0 6C), or do i somehow have to send an acknowledge packet(0x06) as an answere(if i will get the request error again after changing the code).

Junior Member
Posts: 16
Joined: Tue Apr 10, 2018 10:55 pm
Calculators: Casio fx-CG 20

Re: Transfer Files from Arduino to Casio-FX-CG20

Postby randomrguy » Thu Apr 26, 2018 10:17 pm

Yeah, i changed the Code and now its working like it should :D

Senior Member
Posts: 112
Joined: Mon Mar 02, 2015 10:53 am
Calculators: Casio fx-CG 20

Re: Transfer Files from Arduino to Casio-FX-CG20

Postby AmazoNKA » Sat Apr 28, 2018 11:25 am

Great news. Do you mind posting the updated code please? Thanks

PreviousNext

Return to Calculator Hacking/Modding Discussions

Who is online

Users browsing this forum: No registered users and 2 guests