Forum > Debugger

Raspbian: running a program using PascalIO from the IDE

<< < (2/6) > >>

MarkMLl:

--- Quote from: GuidoJ on March 02, 2021, 06:23:17 pm ---Four cases:
1. console -> "sudo ./MyGPIOtest" - result OK
2. start in IDE [F9] - LED does not react to button
3. start in IDE [F9], singlestepping [F8] - result OK
4. start in IDE without debugger [ctrl][shift][F9] - LED does not react to button

Cases 2 and 4 - running inside the IDE but not singlestepping [F8] through the code - are the problem.

GPIO group? Ah... "sudo adduser pi gpio" -> the user "pi" is already in the group "gpio"
So the answere is "yes".

--- End quote ---

I don't have a confident answer then. I've been looking at lower-level access to the GPIO bits over the last week or so, i.e. interacting directly with them at the /sys/class/gpio/* or /dev/gpiochip* level (there's two different APIs) but not using PascalIO... my major interest was trying to disentangle different behaviour on PCs and RPis.

I think one final thing I'd suggest is to add an APM like this


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---var  IOvalue : boolean; procedure TForm1.Button1Click(Sender:TObject);var  pin: TGpioLinuxPin;begin  IOvalue := not IOvalue;  pin := TGpioLinuxPin.Create(12);  pin.Direction := gdOut;  pin.Value := IOvalue;  Application.ProcessMessages;  pin.Destroyend; 
...just in case there's something tricky about the way the component has been written.

MarkMLl

GuidoJ:
Nope, the APM did not work! I guess, I just have to learn more about rights and user levels in Linux.

My current project: Make my heating react to the weather forecast.


* Get a forecast website via HTTP/HTTPS
* Parse the website and extract the sunshine hours and temperature data (already running on windows)
* Switch off the gas heater "a few hours" before the sun starts to shine and let the thermal solar system take over
* ...using GPIO and maybe an optocoupler to signal the status to the heating
* (later) readout the energy content of the solar tanks via 1-wire-bus.
Thanks, Mark, for your ideas.

MarkMLl:
I'm a bit bemused as to what's going on. At this point the normal thing would be for you to zip or tar your entire project and tack it onto a message so that somebody else could try it... I for one though aren't promising immediate time since tomorrow is going to be hard enough work as it is.

MarkMLl

avra:

--- Quote from: GuidoJ on March 02, 2021, 06:23:17 pm ---1. console -> "sudo ./MyGPIOtest" - result OK
2. start in IDE [F9] - LED does not react to button
3. start in IDE [F9], singlestepping [F8] - result OK
4. start in IDE without debugger [ctrl][shift][F9] - LED does not react to button
--- End quote ---
Does "./MyGPIOtest" without sudo works? If not, then sudo gives some permissions that debugger already has, but IDE and simple command line do not have? Normally, gpio group should be enough, so you should investigate why sudo makes the difference in your case.

GuidoJ:
Thanks, avra!

Without sudo the LED does not react, so sudo (root rights) are needed. That is also stated in the documentation of the PascalIO Package.

I did some tracing an added some more code. The error occurs at FpOpen('/sys/class/gpio//gpio12/direction', O_WRONLY); Error 9: Bad file number.

I checked UserID, GroupID and ProcessID with and without debugging, but they where the same.

Is there a way to run the program from the IDE with root privileges? Maybe via "run"->"run parameters"->"launching application"?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version