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-CG20

Transfer Files from Arduino to Casio-FX-CG20

Postby randomrguy » Wed Apr 11, 2018 1:01 pm

Hello, i'm currently working on sending Files(mainly Images) from an Arduino pro mini over the 3-Pin connector/serial port to my Casio FX-CG20.

Solved now :)
Last edited by randomrguy on Mon May 07, 2018 4:30 pm, edited 7 times in total.

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

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

Postby randomrguy » Wed Apr 11, 2018 1:12 pm

.
Last edited by randomrguy on Thu Apr 12, 2018 12:27 pm, edited 1 time in total.

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

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

Postby randomrguy » Wed Apr 11, 2018 1:50 pm

I updated the Code now with checking for Ack, but its still not working. As soon as i connect the calculator to the Arduino, change cable to 3pin and press "RECV" my console is printing: _|0000000|_Error check
_|0000000|_Error check
_|00000000|_Error check
_|00|_Error check
_|000000|_Error check
_|000000|_Error check
_|000000|_Error check
_|000000|_Error check
_|000000|_Error check
_|0000000|_Error check
_|000000|_Error check
_|0000000|_Error check
_|000000|_Error check
_|0000000|_Error check
as response, where the __||__ are just seperators. I dont know why this is not working, could it maybe also be, because i updated the operating system of the casio?
I also have a problem with the forum, sometimes when i update my post, it just disappeares and i have to create it again. So i had to create the last post again, but i think it was because of my firefox addons/settings and it should be working now.
Also some comments in my code were missing and i updated them now.
I dont know what the bytes of the example(commented with //???) are send for.

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: Transfer Files from Arduino to Casio-FX-CG20

Postby SimonLothar » Sat Apr 14, 2018 8:35 am

randomrguy wrote:I updated the Code now with checking for Ack, but its still not working. As soon as i connect the calculator to the Arduino, change cable to 3pin and press "RECV" my console is printing: _|0000000|_Error check
_|0000000|_Error check
_|00000000|_Error check
_|00|_Error check
_|000000|_Error check
_|000000|_Error check
_|000000|_Error check
_|000000|_Error check
_|000000|_Error check
_|0000000|_Error check
_|000000|_Error check
_|0000000|_Error check
_|000000|_Error check
_|0000000|_Error check
as response, where the __||__ are just seperators. I dont know why this is not working, could it maybe also be, because i updated the operating system of the casio?
If "Error check" is 0xFF and the Zeros are binary zeros , this looks like a typical pattern of a baudrate-mismatch.

randomrguy wrote:I dont know what the bytes of the example(commented with //???) are send for.
These control codes are documented in fxReverse2x.pdf, which should be a part of fx_calculators_SuperH_based.chm ("Further reading").
I'll be back!

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

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

Postby randomrguy » Sat Apr 14, 2018 7:30 pm

Error check is just my String to be printed when no ack package is received.

And the baudrates should be fine, if the casio baudrate is 9600 at default, because in the arduino i set it to 9600.

I've read the fxRReverse2x.pdf, but couldnt find anything about the commented bytes from your file transfer example.

Do you maybe have to set the baudrrate via
4.3.2 System command reference-"02":Set link settings
first and if so, how do you do that?


I would be very glad, if you could talk with me on discord/teamspeak/etc and maybe take a look via teamviewer. Just write me your prefered time(idk about the time zone, i'm in germany with UTC +2), if you have some free time available.

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: Transfer Files from Arduino to Casio-FX-CG20

Postby SimonLothar » Sun Apr 15, 2018 7:33 am

randomrguy wrote:Error check is just my String to be printed when no ack package is received.
Before starting a file transfer or any other commend, there should be ensured, that the check-packet is properly answered by the ack-packet (See fxReverse 4.10.1).
Could you log the bytes, which are actually exchanged by the serial interface and post them as hex-numbers?
F. i. like
out: 05 30 30 30 37 30
in: 06 30 30 30 37 30

randomrguy wrote:I've read the fxRReverse2x.pdf, but couldnt find anything about the commented bytes from your file transfer example.
See 4.3.1 of fxReverse
casio.write("00");//??? : SD1
casio.write("08");//??? : SD2 (in this case the length of D2 (FILENAME))
casio.write("00");//??? : SD3
casio.write("00");//??? : SD4

casio.write("04");//??? : SD5 (in this case the length of D5 (fls0))
casio.write("00");//??? : SD6
casio.write("FILENAME");//filename (D2)
casio.write("fls0");//??? D5 (the name of the drive to use (on the prizm, there is "fls0" only, which is the storage memory. On calculators with SD-card, there could be used "crd0" as well.))
I'll be back!

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

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

Postby randomrguy » Sun Apr 15, 2018 3:57 pm

Thank you, i understand the bytes now and i also found out that the libary i used with the arduino wasnt working that well, so i'm using a diffrent one now and i managed to get the start working. Im gonna try the file transfer later today and post the results.
Last edited by randomrguy on Mon Apr 16, 2018 10:33 pm, edited 3 times in total.

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

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

Postby randomrguy » Sun Apr 15, 2018 4:28 pm

I've updated my program now and with the new program im still having trouble sending files. I updated the main post with the new Code(finally got the checksum working), but im not sure, if i missed something. Can you take a look at it pls, because i'm not sure why it's still not working.
Everything in my Code looks fine and i'm sending the exact same bytes of your file transfer example, but im getting these errors:

It seems like the casio is just sending the same bytes back.
The only good thing is, that i got a FILENAME file on the casio with no data in it, when i press RECV at the beginning of the connection.

When i do not press RECV on the casio and just let the arduino transfer the file, im getting:

out:0x05 00 0 70
in: 0x05 00070 //maybe only delay from casios own check, or is it just sending the bytes back the same as below with the file transfer?
check
out:0x06 00 0 70
in:0x06 00070 //maybe only delay from casios own ack, or is it just sending the bytes back the same as below with the file transfer?
in:
check
check
Remaining:
sending File, out:0x01 45 1 0024 00 00 00000008 00 08 00 00 04 00 FILENAME fls0 56
in:0x01 4510024000000000008000800000400FILENAMEfls056
check
check
Error sendFile
Remaining:

When i manually press RECV on the casio after the connection check, im getting no bytes at all send back to the arduino(not even error package, or ack package) from the casio as a response to the file package.
The start with check/ack is the same as above.

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

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

Postby randomrguy » Thu Apr 19, 2018 5:22 pm

Im not sure why the casio isnt responding in the right way. It's still just sending the same bytes back to me. Even when i got no message back, it was because of some random bytes before.

The log with the raw bytes send(as decimals) below the input:
out:0x05 00 0 70
in:0x05 00070//forum cant show the ascii char relative to 0x05
5 48 48 48 55 48
check
out:0x06 00 0 70
in:0x06 00070
6 48 48 48 55 48
in:

check
check
Remaining:
sending File, out:0x01 45 1 0024 00 00 00000008 00 08 00 00 04 00 FILENAME fls0 56
in:0x01 4510024000000000008000800000400FILENAMEfls056
1 52 53 49 48 48 50 52 48 48 48 48 48 48 48 48 48 48 48 56 48 48 48 56 48 48 48 48 48 52 48 48 70 73 76 69 78 65 77 69 102 108 115 48 53 54
check
check


The good thing is, i can already send files with data to the casio and its working kinda ok, but i can never be sure if the files arrived correctly, because the casio just isnt answering.

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

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

Postby randomrguy » Fri Apr 20, 2018 2:26 pm

I maybe also have wired the rx/tx wires the wrong way from the casio to the arduino, because when i wire them the other way around, i get a diffrent response for a check request:

out:0x05 00 0 70
in:0x06 ⸮⸮⸮8⸮
6 192 192 192 56 192

the number of bytes seems to be right for an ack packet and the first byte is equal to 0x06 in hex, but i dont know why the other bytes are the way they are, because shouldnt they be 6 48 48 48 55 48 to get 0x06 "00070" in ascii hex?
Anyways that could be another mistake, because when they are wired like this i atleast get diffrent bytes send back(but seems like not the correct ones). But if they are wired the right way now, why did the file transfer succed with the other wiring?
So im not sure whats the right wiring now.

Next

Return to Calculator Hacking/Modding Discussions

Who is online

Users browsing this forum: No registered users and 29 guests