Go to advanced search

by dsyleixa123
Thu Jun 13, 2019 7:15 am
Forum: C/C++
Topic: default priorities of user programs (single thread, pthread) and of programs run by the kernel ?
Replies: 13
Views: 1018

Re: default priorities of user programs (single thread, pthread) and of programs run by the kernel ?

thanks, yes, that is actually the crucial question I am trying to solve: For my own program I can probably define and handle different SCHED_RR prios, but which prio should I choose to be safe over kernel threads, tasks, programs, and/or daemons so that they don't temporarily take over and disturb m...
by dsyleixa123
Thu Jun 13, 2019 7:11 am
Forum: C/C++
Topic: code for UART comm from Pi to Arduino hangs up
Replies: 46
Views: 2460

Re: code for UART comm from Pi to Arduino hangs up

I put my former code from the loop function into a pthread by medium to high SCHED_RR priority, currently trying some different prio values to find the optimum (tried so far: prios 40 to 60).
by dsyleixa123
Wed Jun 12, 2019 11:22 pm
Forum: C/C++
Topic: default priorities of user programs (single thread, pthread) and of programs run by the kernel ?
Replies: 13
Views: 1018

Re: default priorities of user programs (single thread, pthread) and of programs run by the kernel ?

thank you Paeryn for your reply! So IIUC, the scheduler rules (for FIFO, RR, OTHER) cannot directly be compared to each other by identical level numbers. Having read some posts here in this forum I thought SCHED_RR might be the best for my purposes as far as I understood, so I tested with prios of 4...
by dsyleixa123
Wed Jun 12, 2019 8:57 pm
Forum: C/C++
Topic: code for UART comm from Pi to Arduino hangs up
Replies: 46
Views: 2460

Re: code for UART comm from Pi to Arduino hangs up

- solved -
by dsyleixa123
Wed Jun 12, 2019 3:56 pm
Forum: C/C++
Topic: default priorities of user programs (single thread, pthread) and of programs run by the kernel ?
Replies: 13
Views: 1018

default priorities of user programs (single thread, pthread) and of programs run by the kernel ?

hello,
which are the default thread priorities of common single-thread programs (C++ sources) ,
multithreading executables using pthread (C++ sources, no arbitrary pthread priorities, just defaults)
and which priorities have programs run by the kernel?
by dsyleixa123
Tue Jun 11, 2019 12:49 pm
Forum: C/C++
Topic: code for UART comm from Pi to Arduino hangs up
Replies: 46
Views: 2460

Re: code for UART comm from Pi to Arduino hangs up

don't expect us to do your work.
hahaha! Never heard that before - (tbh, mostly from people who personally only have vague ideas (plus unfounded suspicions) but are not able to provide actually working code though) ;)
by dsyleixa123
Tue Jun 11, 2019 8:49 am
Forum: C/C++
Topic: wiringPi undefined Reference
Replies: 28
Views: 40787

Re: wiringPi undefined Reference

I downloaded the wiringPi library directly as tar.gz file. I extracted it and then I build it. I hope i followed correct steps. Then I am trying to compile and build the simple blink program but it shows the same error of undefined reference. I am also adding the -lwiringpi in my compile line but i...
by dsyleixa123
Mon Jun 10, 2019 5:38 pm
Forum: C/C++
Topic: Counter and timer on Raspberry Pi 2?
Replies: 5
Views: 421

Re: Counter and timer on Raspberry Pi 2?

thanks, yes, I seen that already long time ago... ;)
BTW: Mr or Mrs ? ;)
by dsyleixa123
Mon Jun 10, 2019 5:02 pm
Forum: C/C++
Topic: Counter and timer on Raspberry Pi 2?
Replies: 5
Views: 421

Re: Counter and timer on Raspberry Pi 2?

hello, Mr or Mrs (?) Joan, I always have been interested in pigpio but could not find an easy access to it yet.... do you have a repo listing all your single functions and related examples ? Or perhaps something like cplusplus.com how they are listing all C/C++ functions by definitions, descriptions...
by dsyleixa123
Mon Jun 10, 2019 3:56 pm
Forum: C/C++
Topic: Counter and timer on Raspberry Pi 2?
Replies: 5
Views: 421

Re: Counter and timer on Raspberry Pi 2?

hi, have you already taken a look at wiringPi? At least for convenient timer and GPIO r/w and interrupt functions it works (mostly): http://wiringpi.com/ https://github.com/WiringPi/WiringPi/tree/master/examples (this is an unofficial repo mirror, unfortunately I don't know an "official" repo in the...
by dsyleixa123
Mon Jun 10, 2019 2:37 pm
Forum: C/C++
Topic: code for UART comm from Pi to Arduino hangs up
Replies: 46
Views: 2460

Re: code for UART comm from Pi to Arduino hangs up

I think what you are missing is the following: my setup for my Arduino is fine, it's the same as I am using to communicate with the PC and/or with another Arduino - with the PC and/or with another Arduino it works, with the Pi it temporarily (!) does not (sometimes already after a couple of seconds ...
by dsyleixa123
Sun Jun 09, 2019 6:40 pm
Forum: C/C++
Topic: code for UART comm from Pi to Arduino hangs up
Replies: 46
Views: 2460

Re: code for UART comm from Pi to Arduino hangs up

that looks like what wiringSerial serialGetchar(fd) is supposed to do, but that fails, so what is the advantage? where is the timeout handling, the buffer handling, perhaps intermediate buffers if bytes don't come fast enough or by gaps, a flush, a disconnect and a resync in case it's needed? Both t...
by dsyleixa123
Sun Jun 09, 2019 5:35 pm
Forum: C/C++
Topic: code for UART comm from Pi to Arduino hangs up
Replies: 46
Views: 2460

Re: code for UART comm from Pi to Arduino hangs up

the USB cables I had already checked and swapped, also a 2nd Mega2560, also a Arduino Due (Atsam3x8e or so) using different microUSB cables. All the same, runs for a time, then stalls. Arduinos connected to my PC (Borland C++ Builder): no problem, runs like a charm. All I would need is a simple-to-u...
by dsyleixa123
Sun Jun 09, 2019 1:12 pm
Forum: C/C++
Topic: code for UART comm from Pi to Arduino hangs up
Replies: 46
Views: 2460

Re: code for UART comm from Pi to Arduino hangs up

thanks for your comments, but all that is far beyond my skills, I just can handle a little bit of wiringPi, even pigpio or above all native UART or termios are far too complicated (and what the hell is PL011 or MniAUX?) : so a very convenient lib (apart from wiringPi, if necessary) and a working cod...
by dsyleixa123
Sun Jun 09, 2019 7:41 am
Forum: C/C++
Topic: code for UART comm from Pi to Arduino hangs up
Replies: 46
Views: 2460

Re: code for UART comm from Pi to Arduino hangs up

no, I'm using a Mega2560 (AVR), and the Serial class (esp. Serial.readStringUntil() , Serial.available() ) is supposed to manage all the transmissions, buffers, and timeouts correcty: https://www.arduino.cc/reference/en/language/functions/communication/serial/ https://www.arduino.cc/reference/en/lan...
by dsyleixa123
Sat Jun 08, 2019 3:17 pm
Forum: C/C++
Topic: code for UART comm from Pi to Arduino hangs up
Replies: 46
Views: 2460

Re: code for UART comm from Pi to Arduino hangs up

tbh, termios looks far too complicated to me and I don't have any experience or skills using that. OTOH I thought that wiringPi/wiringSerial actually would work reliably (doesn't it?). Basically I am using wiringSerial libs because they look sort of Serial()-like from the Arduino Serial() class (eve...
by dsyleixa123
Sat Jun 08, 2019 11:11 am
Forum: C/C++
Topic: code for UART comm from Pi to Arduino hangs up
Replies: 46
Views: 2460

Re: code for UART comm from Pi to Arduino hangs up

code updated for debug reasons:
i0 now is incremented in each Arduino loop and sent back,
and i2 is now incremented in each Raspi loop and sent back;

all incremets are processed correctly and also received correctly vice versa.
But it still hangs up after a while.

Does anyone have a clever idea?
by dsyleixa123
Sat Jun 08, 2019 11:10 am
Forum: C/C++
Topic: code for UART comm from Pi to Arduino hangs up
Replies: 46
Views: 2460

Re: code for UART comm from Pi to Arduino hangs up

AFAIK the Arduino code is fail-safe now, because Serial.readStringUntil() now covers all timeouts and buffers. what would be the failsafe Raspi code? Until now, it still always hangs up after a couple of seconds, either with or without extra Raspi timeouts. (code updated for debug reasons, i0 now is...
by dsyleixa123
Fri Jun 07, 2019 9:41 am
Forum: C/C++
Topic: avoid compile warnings about ISO C++ forbids converting a string constant to ‘char*’
Replies: 24
Views: 1869

Re: avoid compile warnings about ISO C++ forbids converting a string constant to ‘char*’

thank you, Paeryn, now I got it: this code now compiles and works fine: #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <stdint.h> #include <errno.h> #include <pthread.h> #include <wiringPi.h> #include <wiringSerial.h> #define TOKLEN 30 int16_t strstrpos(const...
by dsyleixa123
Thu Jun 06, 2019 4:03 pm
Forum: C/C++
Topic: avoid compile warnings about ISO C++ forbids converting a string constant to ‘char*’
Replies: 24
Views: 1869

Re: avoid compile warnings about ISO C++ forbids converting a string constant to ‘char*’

I did that already (more or less): ;) #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <string.h> #include <stdint.h> #include <errno.h> #include <pthread.h> #include <wiringPi.h> #include <wiringSerial.h> #define TOKLEN 30 int16_t strstrpos(char * haystack, char * needle) // find...
by dsyleixa123
Thu Jun 06, 2019 9:06 am
Forum: C/C++
Topic: avoid compile warnings about ISO C++ forbids converting a string constant to ‘char*’
Replies: 24
Views: 1869

Re: avoid compile warnings about ISO C++ forbids converting a string constant to ‘char*’

the standard gcc coming with Stretch.
The code is just as it is, like published.
compile flag -Wall.
and again, it's not crucial actually, just undesirable and a bit confusing among other (perhaps important) warnings.
by dsyleixa123
Thu Jun 06, 2019 9:00 am
Forum: C/C++
Topic: avoid compile warnings about ISO C++ forbids converting a string constant to ‘char*’
Replies: 24
Views: 1869

Re: avoid compile warnings about ISO C++ forbids converting a string constant to ‘char*’

if I use all possible options arbitrarily (both for strstrpos and for cstringarg), I get warnings or even errors, as stated.
dsyleixa123 wrote:
Thu May 30, 2019 11:36 am
now passing a char[] as a vname failes (error):

char test[30];
strcpy(test, "xpos");
cstringarg(cbuf, test, cval);

I think I have to live with the warnings... ;)
by dsyleixa123
Thu Jun 06, 2019 8:57 am
Forum: C/C++
Topic: avoid compile warnings about ISO C++ forbids converting a string constant to ‘char*’
Replies: 24
Views: 1869

Re: avoid compile warnings about ISO C++ forbids converting a string constant to ‘char*’

that would probably be the worst case, because I have to check mostly variable needle strings in variable haystacks or constant needle strings in variable haystacks, so eventually I need to have all options.
by dsyleixa123
Thu Jun 06, 2019 8:43 am
Forum: C/C++
Topic: avoid compile warnings about ISO C++ forbids converting a string constant to ‘char*’
Replies: 24
Views: 1869

Re: avoid compile warnings about ISO C++ forbids converting a string constant to ‘char*’

yes, strstrpos does not alter the needle or haystack strings, nevertheless I also need to use this function arbitrarily to check for variable needles in variable haystacks. And sometimes for constant needles in variable haystacks. And perhaps sometimes also coincidentally in a constant haystack, exc...
by dsyleixa123
Thu Jun 06, 2019 7:48 am
Forum: C/C++
Topic: avoid compile warnings about ISO C++ forbids converting a string constant to ‘char*’
Replies: 24
Views: 1869

Re: avoid compile warnings about ISO C++ forbids converting a string constant to ‘char*’

yes, thank you, of course I understood the basic difference betwen a const and a variable string, but to me a string is a string is a string and I want to handle all strings by the same way when passed to a function (of course not expecting that function to change the constant one, but instead accep...

Go to advanced search