Les membres ayant 30 points peuvent parler sur les canaux annonces, projets et hs du chat.
La shoutbox n'est pas chargée par défaut pour des raisons de performances. Cliquez pour charger.

Forum Casio - Autres questions


Index du Forum » Autres questions » English: Help regarding serial communications on 9860gIII
Axia4xy Hors ligne Membre Points: 24 Défis: 0 Message

English: Help regarding serial communications on 9860gIII

Posté le 14/09/2024 13:30

I only speak English, thank you for taking the time to reply and also my apologies in advance.
I have been programming calculators for over 4 months now, starting off with the Casio SDK but quickly moving onto gint as many standard library functions I could not get working in the Casio SDK in windows. Gint has been a lifesaver, but I hope some of you can understand my frustration in trying to find information.
My question is this: Can anyone provide instructions or a working example of how I could get serial communications working in gint (both TX and RX)? I have read and investigated libSerial, but I could not get it to compile (anything resulting in a "undefined reference to '_Serial_Write' error or similar), and I am also similarly stuck on the gint world switching.

(I am currently working on LoRa radio communication with an ESP32 and I know this works because I have successfully gotten it working with the 'Serial Monitor' add in, but unfortunately this is not suited to my needs)
I truly do not want to go back to the Casio SDK as it truly hurt me to use.


Lephenixnoir Hors ligne Administrateur Points: 24670 Défis: 170 Message

Citer : Posté le 14/09/2024 14:26 | #


No worries about speaking English—this website is French-only due to being badly programmed, not to exclude users.

Serial support is one of gint's weaknesses at the moment, because there is no serial driver for gint—it's been on my TODO list for a long time... but behind a Ph.D, meaning it just hasn't been done yet. The whole story with libSerial is that you can use the OS' serial interface by world-switching out of gint and then using syscalls, which libSerial wraps for you. It's the "gint doesn't have it, so I'm not gonna use gint for that part" solution.

libSerial provides install instructions for GiteaPC so if you have that you should be able to giteapc install Slyvtt/libSerial and use it. If you have undefined references then you might have forgotten to link the library explicitly in your project, by adding -lserial at the end of the target_link_libraries() line your project's CMakeLists.txt. If that's not enough or you already do it, please provide a copy of your project or a reproducer and I'll investigate further.

(Also I'm glad you like gint better than the Casio SDK! Yay!)
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Axia4xy Hors ligne Membre Points: 24 Défis: 0 Message

Citer : Posté le 15/09/2024 04:02 | #


Thank you so much for the response, adding -lserial and shifting the libserial.a file around a bit has gotten the following code to successfully compile :
#include <gint/display.h>
#include <gint/keyboard.h>
#include <serial.h>
#include <gint/gint.h>

int main(void)
{
    unsigned char config[6] = {0, 5, 0, 0, 0, 0};
    unsigned char buffer[] = {"abc"};
    int key=0;
    dclear(C_WHITE);
    dtext(1, 1, C_BLACK, "Test serial transmission:");
    dupdate();

    while(key!=KEY_EXIT)
    {
        key = getkey().key;
        if(key==KEY_EXE)
        {
            gint_world_switch(GINT_CALL(Serial_Open, config));
            gint_world_switch(GINT_CALL(Serial_Write, buffer, 0));
        }
    }
    return 1;
}

However, on a single press of EXE, the calculator hangs (no gint or OS exception) and restarts to become completely unresponsive to all key presses. A press of the reset button solves this problem however. This lead me to start troubleshooting omitting the Serial_Write line for simplicity which lead to an OS error. This made me suspect that the libSerial syscalls were not compatible with the fx-9860GIII that I have, which turned out to be true. Looking through the source of libSerial, I found that the syscall called on Serial_Open is 0x1BB7, which should equate to the 9860GIII syscall of 0x0418 with the same usage. After changing this syscall in Serial_Open.S, and updating the asm.h header with the correct table base address and rebuilding with giteapc, low and behold the serial port opens (heard by the significant increase of noise on a connected speaker).
I now have hope that this will work. Oh and as for the world switching, I was trying to implement the world switching described in drivers.h rather than the much simpler gint.h!
Now adding in Serial_Write with the appropriate syscall, the calculator serial messages perfectly to the radio which rebroadcasts the message for others to see. Yes, this is to message my friends at school on calculators within around 1km of each other and in the entire region if we fully utilize the mesh network in our region. Adding Serial_Read again works perfectly receiving messages that others send to me. Now I just have to polish my code up and maybe make something somewhat resembling a text message gui.
Thank you so much for your help Lephenixnoir, this would literally not be possible without you and your work.
The end result will likely end up published here for anyone interested to use, but it may take me a while.
(For anyone who stumbles across this and is interested, I am using metastatic radio firmware on a Heltec v3 board and gosh, even the thought of messaging on calculators makes me so happy)
High School student of New Zealand daily driving the fx-9860G-III
Lephenixnoir Hors ligne Administrateur Points: 24670 Défis: 170 Message

Citer : Posté le 15/09/2024 10:23 | #


So you just solved all the next problems immediately, that's quite impressive. Glad you got it!

The radio transmission is just a golden idea. I'm afraid the signal will not reach the other side of the earth or I would participate. Someone just made a bridge to use the website chat from the calculator but it still requires a computer. One day with an ESP maybe...
Mon graphe (11 Avril): ((Rogue Life || HH2) ; PythonExtra ; serial gint ; Boson X ; passe gint 3 ; ...) || (shoutbox v5 ; v5)
Axia4xy Hors ligne Membre Points: 24 Défis: 0 Message

Citer : Posté le 15/09/2024 11:16 | #


The funny thing is, the meshtastic project does cater for global communication officially via an internet bridge. (I have been playing with mesh for a while but am not an expert so bear that in mind) It is relatively simple to set up but does require an internet connected node somewhere in your mesh (within range of any radio of any radio in range of yours etc) that is specifically set up for a channel. There is a reasonable amount of nodes with public locations shown on Mesh Map which suggests many more in France which would extend the reliability and range of the network but it is still not perfect no matter what. If you and maybe a few Planet Casio members were in reasonable proximity then it would be worth a shot but otherwise everyone configuring their own internet gateway is a significant barrier to entry. There also other interesting options to connect to a mesh, such as having a Pi running Google's DeepMind Gemma which can answer questions sent from a calculator! Side note over, the shoutbox client does look interesting and I may see if i can implement a primitive version on my poor calculator. I have sending serial messages working reasonably well but receiving is a different story... My early testing highlights some problems consistently reading from the serial buffer, but is too early to see if it is an issue with some obscure part of calculator firmware, my code, or the radio. It is times like these that an oscilloscope would come in handy! I will give it a few nights and see what comes from it from there.
High School student of New Zealand daily driving the fx-9860G-III

LienAjouter une imageAjouter une vidéoAjouter un lien vers un profilAjouter du codeCiterAjouter un spoiler(texte affichable/masquable par un clic)Ajouter une barre de progressionItaliqueGrasSoulignéAfficher du texte barréCentréJustifiéPlus petitPlus grandPlus de smileys !
Cliquez pour épingler Cliquez pour détacher Cliquez pour fermer
Alignement de l'image: Redimensionnement de l'image (en pixel):
Afficher la liste des membres
:bow: :cool: :good: :love: ^^
:omg: :fusil: :aie: :argh: :mdr:
:boulet2: :thx: :champ: :whistle: :bounce:
valider
 :)  ;)  :D  :p
 :lol:  8)  :(  :@
 0_0  :oops:  :grr:  :E
 :O  :sry:  :mmm:  :waza:
 :'(  :here:  ^^  >:)

Σ π θ ± α β γ δ Δ σ λ
Veuillez donner la réponse en chiffre
Vous devez activer le Javascript dans votre navigateur pour pouvoir valider ce formulaire.

Si vous n'avez pas volontairement désactivé cette fonctionnalité de votre navigateur, il s'agit probablement d'un bug : contactez l'équipe de Planète Casio.

Planète Casio v4.3 © créé par Neuronix et Muelsaco 2004 - 2024 | Il y a 109 connectés | Nous contacter | Qui sommes-nous ? | Licences et remerciements

Planète Casio est un site communautaire non affilié à Casio. Toute reproduction de Planète Casio, même partielle, est interdite.
Les programmes et autres publications présentes sur Planète Casio restent la propriété de leurs auteurs et peuvent être soumis à des licences ou copyrights.
CASIO est une marque déposée par CASIO Computer Co., Ltd