You can help CodeWalrus stay online by donating here. | New CodeWalrus | Old (dark mode) | Old (light) | Discord server

TI Nspire uart

b/Calculator Development Started by TheStaticTurtle, January 20, 2018, 01:44:33 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

u/Vogtinator January 20, 2018, 10:07:17 PM
Can you try without the exclamation mark in that line?
u/TheStaticTurtle January 21, 2018, 10:00:07 AM
It stilll blocking at 32 chars  :'(
u/Vogtinator January 21, 2018, 10:55:15 AM
I'm not sure what I can do with remote debugging here...

I'd suggest you try some more ways to configure the PL010 UART, maybe try turning the FIFO off.
There's also still the possibility that there's something wrong on the sender's side.
u/TheStaticTurtle January 21, 2018, 12:30:22 PM
Well can I increase the FIFO buffer size. If not you said that I can write an interrupt for reciveing data but I dont really know how to do that. And if all of that is not really possible how do I disable it ?
u/Vogtinator January 21, 2018, 12:52:41 PM
You can't change th FIFO size, it's the hardware.

For the other questions, take a look at the PL011 manual: http://infocenter.arm.com/help/topic/com.arm.doc.ddi0183f/DDI0183.pdf
u/TheStaticTurtle January 21, 2018, 01:17:14 PM
So I have read the whole pdf but I don't see how to make an interrupt. For first I doesn't done so much C and I absolutly don't know how to make an interrupt but the one thing that I have seen fromthe pdf is that there is a byte to see if the receive FIFO is 1/2 full but I don't know how to make it work.
u/Vogtinator January 21, 2018, 01:31:26 PM
Interrupts aren't required to get it to work if you do everything in a loop.

Just try to configure the UART slightly differently, the register offsets and what the various bits do is all explained within the PDF document.
u/TheStaticTurtle January 21, 2018, 04:06:55 PM
After some time I managed to make this function work :w00t:. So for now my function look like this:
char* uart_getsn(char* str, int num) {
        int i = 0;
        int max = num-1;
        while(1 && releasefunc()) {
                while(uart_ready() && isKeyPressed(KEY_NSPIRE_ESC)) {
                        if(i == max) {
                                str[i] = 0;
                                return str;
                        }
                        char c = uart_getchar();
                        str[i] = c;
                        if(c == '\b'){  i -= 2; }
                        else if(c == '\r')      { str[i] =0; return str; }
                        i++;

                }
        }
}


definitvely not perfect since i have to send \r after each command  and I have added  isKeyPressed(KEY_NSPIRE_ESC) to the while in case of stuck (append only one time) but I work for me.
u/super-schaf October 01, 2018, 05:23:41 PM
Hello there!

I was just doing some research, prior to starting a uart chat interface for the nspire, when I stumbled upon your lovely posts.
Great to hear someone else out there in the interwebs has the same interest!

I was wondering, Samy, if you have developed your idea any further than the previous posts suggests?
So far you have already saved me a stack of time starting from scratch, and if possible, I'd love to co-op with you to continue on this app.

With warm regards from Switzerland,
Richard

u/TheStaticTurtle October 02, 2018, 01:39:04 PM
While I don't exactly understand you question I'm glad to hhave helped you for something and I indeed continued to work on this project after this post and the program evolved into this:
https://github.com/TurtleForGaming/nspire-communication/blob/master/nspire-client/uart_sms/hello.cpp And if you want to see the whole project look at this post: https://codewalr.us/index.php?topic=2299.0
Website statistics


MyCalcs | Ticalc.org | Cemetech | Omnimaga | TI-Basic Developer | MaxCoderz | TI-Story | Casiocalc.org | Casiopeia | The Museum of HP Calculators | HPCalc.org | CnCalc.org | Music 2000 Community | TI Education | Casio Education | HP Calcs | NumWorks | SwissMicros | Sharp Calculators
Powered by EzPortal