Raspberry pi GPIO.add_event_detect crash - raspberry-pi3

i have just recently started to play around with raspberry pi and
cannot understand what is happening using GPIO.add_event_detect feature.
The basic program detects when GPIO16 drops due to button press, prints a message, sleeps 1 second and then prints another message. i switch off and on event_detect during callback to avoid switch bounce causing additional callbacks. The issue is however after only two button presses the program crashes??
This happens every time i run the program. GPIO.VERSION '0.6.2'
Here is the program:
import RPi.GPIO as GPIO
from time import sleep
GPIO.setmode(GPIO.BCM)
GPIO.setup(16, GPIO.IN, pull_up_down=GPIO.PUD_UP)
def pressButton(channel):
GPIO.remove_event_detect(channel)
print("Button Pressed")
sleep(1)
print("Button Released")
GPIO.add_event_detect(channel, GPIO.FALLING, callback=pressButton, bouncetime=5)
GPIO.add_event_detect(16, GPIO.FALLING, callback=pressButton, bouncetime=5)
try:
while True:
sleep(1)
finally:
GPIO.cleanup()
And here is the output showing crash after 2 button presses:
Python 3.4.2 (default, Oct 19 2014, 13:31:11)
[GCC 4.9.1] on linux
Type "copyright", "credits" or "license()" for more information.
>>> ================================ RESTART ================================
>>>
Button Pressed
Button Released
Button Pressed
Button Released
>>> ================================ RESTART ================================
>>>
any help appreciated !

Related

Yocto: remote debugging with VSCode - KARO:QS8M-MQ00: NXP: i.Mx8M Mini; debugging: 'Step over'; 'Step into'; 'Step out' does not work

Remote debugging
Host- system: x86, 64Bit; Windows 10 with
wsl2: Ubuntu 18.04.5 LTS
remote system: KARO **QS8M **Eval Kit with QS8M-MQ00 NXP i.MX 8M-Mini Quad Core Cortex-A53
Linux qs8m-mq00 5.15.32-karo+gc01cf92b4155 #1 SMP PREEMPT Fri Aug 5 13:54:11 UTC 2022 aarch64 GNU/Linux
Build directory setup- string:
DISTRO=karo-wayland MACHINE=qs8m-mq00 source karo-setup-release.sh -b build-qs8m-mq00-karo-wayland
**bitbake karo-image-weston **
Target IP: 192.168.180.61
I am trying to retrace the description of remote debugging with VisualStudioCode (VSCode) according:
https://karo-electronics.github.io/docs/software-documentation/vscode/index.html
Running:
'Continue'(F5) - does partially work.
step over; step into; step out : do not work
What also looks strange, that sometimes the debug session jumps into subroutine 'sub' and sometimes not !
No reliable debugging possible.
enter image description here
After pressing 'F5' (Debug):
enter image description here
also wondering:
enter image description here
(but the same as in Your app- note)
enter image description here
"Each time you wish to use the SDK in a new shell session, you need to source the environment setup script e.g.":
. /opt/karo-wayland/5.10-kirkstone/environment-setup-armv8a-poky-linux
enter image description here
Remote system:
$ aarch64-poky-linux-g++ --version
aarch64-poky-linux-g++ (GCC) 11.2.0
Have You an idea on that?
(1) Why does Step over; debugging: 'Step over'; 'Step into'; 'Step out' does not work?
(2) Debugging not reliable sometimes enters into sub-routine sometimes not(!)
Thanks& Regards
Michael
Remote debugging with single Step, StepInto, StepOver possible.

How to get a command to run automatically in RStudio Terminal

I'm on Windows 10.
I want to send a command to a Terminal in RStudio using the rstudioapi. For example:
termId <- rstudioapi::terminalCreate()
rstudioapi::terminalSend(termId, 'dir\n')
My issue is that although the command is sent to the terminal, it does not run automatically. The cursor stays at the end of the line and I need to manually go to the terminal and press Enter.
I have seen many other terminal questions which have the \n at the end of the commands, so I'm certain it should work.
What am I doing wrong?
Thanks!
> sessionInfo()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044)
Matrix products: default
locale:
[1] LC_COLLATE=Spanish_Argentina.utf8 LC_CTYPE=Spanish_Argentina.utf8 LC_MONETARY=Spanish_Argentina.utf8
[4] LC_NUMERIC=C LC_TIME=Spanish_Argentina.utf8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rstudioapi_0.13 RPostgres_1.4.4 DBI_1.1.3
loaded via a namespace (and not attached):
[1] bit_4.0.4 compiler_4.2.1 ellipsis_0.3.2 cli_3.3.0 hms_1.1.1 tools_4.2.1 Rcpp_1.0.8.3
[8] bit64_4.0.5 vctrs_0.4.1 blob_1.2.3 lifecycle_1.0.1 pkgconfig_2.0.3 rlang_1.0.3
In case somebody has the same issue:
I simply replaced the \n with \r and it worked. Don't really understand it as in another laptop it works fine with \n.

the GDB process terminated unexpectedly (exit code3)

i am coding in Qt 5.7 on win 7. my app is run correctly. but when i use the debugger, a error dialog box showed: the GDB process terminated unexpectedly (exit code3).
last part of debugger log :
>~"../../../../src/gdb-7.10.1/gdb/utils.c:1071: internal-error: virtual memory exhausted.\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable.\nCreate a core file of GDB? "
>~"(y or n) [answered Y; input not from terminal]\n"
dUNEXPECTED GDB STDERR:
dThis application has requested the Runtime to terminate it in an unusual way.
dPlease contact the application's support team for more information.
dGDB PROCESS FINISHED, status 0, exit code 3
dNOTE: ENGINE ILL ******
dFORWARDING STATE TO InferiorShutdownFailed
dState changed BY FORCE from InferiorStopOk(14) to InferiorShutdownFailed(17) [master]
dState changed from InferiorShutdownFailed(17) to EngineShutdownRequested(19) [master]
dQUEUE: SHUTDOWN ENGINE
dCALL: SHUTDOWN ENGINE
dPLAIN ADAPTER SHUTDOWN 19
dINITIATE GDBENGINE SHUTDOWN IN STATE 14, PROC: 0
dNOTE: ENGINE SHUTDOWN OK
dState changed from EngineShutdownRequested(19) to EngineShutdownOk(21) [master]
dState changed from EngineShutdownOk(21) to DebuggerFinished(22) [master]
dQUEUE: FINISH DEBUGGER
dNOTE: FINISH DEBUGGER
dHANDLE RUNCONTROL FINISHED
sDebugger finished.
in a part of my code i used QVector:
int logic_points_number=5;
int logic_input_points[16][logic_points_number] ;
QVector<double> x1_1(2*logic_points_number);
QVector<double> y1_1(32*logic_points_number);
x1_position=x1_last_position_logic;//start from last drawn point
for(int logic_channel=0;logic_channel<16;logic_channel++){
for (int i=0;i<logic_points_number ;i++){
if (logic_channel==0)// set x1_1 only for first channel
x1_1[2*i]= x1_position;
y1_1[(2*logic_channel*logic_points_number)+(2*i)]=(16.2-logic_channel)+(0.6*logic_input_points[logic_channel][i]);
if (logic_channel==0){// set x1_1 and x1_position only for first channel
x1_position = x1_position + x1_step_logic;
x1_1[(2*i)+1]= x1_position;
}
y1_1[(2*logic_channel*logic_points_number)+(2*i)+1]=(16.2-logic_channel)+(0.6*logic_input_points[logic_channel][i]);
}
}
x1_last_position_logic= x1_position;//Set new last drawn point
}
in run there is no problem. when i delete the above code, there is no problem in debugger.
there is no helpful answer in google.what i shall to do?
thanks
In my case error code was 'the cdb process terminated unexpectedly (code -805306181)'. Changing debugger from 32 bit app debugger to 64 bit app debugger fixed this issue

Severe problems on getting to work jedi vim (windows)

i have already read a lot of threads with similar topics and the tag jedi-vim here on stackoverflow and also other pages.
But this problem still keeps me from doing my actual work :-/.
Up to now I have already tried several steps back and forth, but basically I did the following:
1. Install latest Python3.4 (32bit)
2. Got this precompiled VIM: (https:// bitbucket.org/Haroogan/vim-for-windows/downloads/vim-7.4.417-python-2.7-python-3.4-ruby-2.0.0-lua-5.2-perl-5.18-windows-x86.zip) (32Bit)
3. Installed Pathogen
4. Installed Flake8 successfully
5. Installed Jedi (systemwide?) with pip
6. Got Jedi-vim from github.com/davidhalter/jedi-vim and unpacked the dir jedi-vim-master to:
6.1. $HOME/vimfiles/bundle/ only
6.2. $VIM/vimfiles/bundle/ only
6.3. BOTH
python and python3 both work (before I ONLY had python3).
So
":python3 import sys; print(sys.version)" and
":python2 import sys; print(sys.version)" give an output.
In my vimrc I force jedi-vim to use python3:
"let g:jedi#force_py_version = 3"
And now the actual error is the following:
When I type e.g. "self." in a *.py-file he searches for half a sec and says:
E117: unknown function: pythoncomplete#Complete
-- Omni completion (^O^N^P) Pattern not found
When I want to call a function and want type the parameters, something pops up / gets faded in, but it's some unclear signs and not the actual parameters.
see here
Other info:
:scriptnames :
D:\tools\v\plugin\getscriptPlugin.vim
D:\tools\v\plugin\gzip.vim
D:\tools\v\plugin\matchparen.vim
D:\tools\v\plugin\netrwPlugin.vim
D:\tools\v\plugin\rrhelper.vim
D:\tools\v\plugin\spellfile.vim
D:\tools\v\plugin\tarPlugin.vim
D:\tools\v\plugin\tohtml.vim
D:\tools\v\plugin\vimballPlugin.vim
D:\tools\v\plugin\zipPlugin.vim
D:\tools\v\menu.vim
D:\tools\v\lang\menu_de.latin1.vim
D:\tools\v\lang\menu_de_de.latin1.vim
D:\tools\v\autoload\paste.vim
D:\tools\v_gvimrc
D:\tools\v\syntax\syntax.vim
D:\tools\v\syntax\synload.vim
D:\tools\v\syntax\syncolor.vim
D:\tools\v\filetype.vim
H:\vimfiles\autoload\pathogen.vim
D:\tools\v\ftoff.vim
D:\tools\v\syntax\nosyntax.vim
D:\tools\v\ftplugin.vim
D:\tools\v\indent.vim
D:\tools\v\syntax\python.vim
D:\tools\v\ftplugin\python.vim
D:\tools\v\bundle\jedi-vim-master\ftplugin\python\jedi.vim
D:\tools\v\bundle\jedi-vim-master\autoload\jedi.vim
D:\tools\v\bundle\vim-flake8-master\ftplugin\python_flake8.vim
H:\vimfiles\bundle\vim-flake8-master\ftplugin\python_flake8.vim
D:\tools\v\indent\python.vim
My vimrc:
https://drive.google.com/file/d/0Bwb4EPY-atMdOWhnOGJiNmxYbGM/view?usp=sharing
Your problem is that the jedi-vim completion function is never called.
The error message is about pythoncomplete#Complete, which is VIM's default, but it should be set to :set omnifunc=jedi#completions.
I feel like the last line in scriptnames (D:\tools\v\indent\python.vim) overwrites omnifunc. Don't know why and how it happens, but that's my gut feeling.

CDT 6 (eclipse galileo) snow leopard debugging issue

I upgrade to snow leopard and Xcode 3.2 this week, and since that, I'm having problems with CDT. I tried this in CDT 5 (Ganymede) and CDT 6 (Galileo).
If I try to debug the application using launcher "Standard Create Process Launcher", it delays about 10 seconds to actually get in the debugging breakpoint, which is very odd.
If I use as launcher "GDB (DSF) Create Process Launcher" it works at the speed I expect, but the variables tab that shows me what's going on in the current scope show the variable values like that:
"Failed to execute MI command:
-var-update 1 var2
Error message from debugger back end:
Variable object not found
Failed to execute MI command:
-var-update 1 var1
Error message from debugger back end:
Variable object not found"
I don't have any idea how to solve one or the other issue, any of them will let me work up to speed.

Resources