KeyboardInterrupt Ctrl+c does not work
-
- Posts: 22
- Joined: Sat Jun 20, 2015 11:48 am
KeyboardInterrupt Ctrl+c does not work
Hello,
i have tested recent build of micropython on STM32F407 Discovery Board, Unfortunately the KeyboardInterrupt 'ctrl+c' does not work, no effect. The build about 3 weeks ago, it worked well. I've using minicom on OSX10.5
Does anyone know, how to solve it.
Thanks in advance.
i have tested recent build of micropython on STM32F407 Discovery Board, Unfortunately the KeyboardInterrupt 'ctrl+c' does not work, no effect. The build about 3 weeks ago, it worked well. I've using minicom on OSX10.5
Does anyone know, how to solve it.
Thanks in advance.
Re: KeyboardInterrupt Ctrl+c does not work
I flashed using the latest from the repository and both raising a KeyboardInterrupt and pressing Control-C both seem to be working fine.
Here's the program I tested: and this is the output from pressing the blue pushbutton: and this is the output of pressing Control-C:
Here's the program I tested:
Code: Select all
import pyb
sw = pyb.Switch()
while True:
pyb.LED(1).on()
pyb.delay(100)
pyb.LED(2).on()
pyb.delay(100)
pyb.LED(1).off()
pyb.delay(100)
pyb.LED(2).off()
pyb.delay(700)
if sw():
raise KeyboardInterrupt
Code: Select all
MicroPython v1.8.3-24-g095e43a-dirty on 2016-08-15; F4DISC with STM32F407
Type "help()" for more information.
>>>
>>> import ctrlc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "ctrlc.py", line 15, in <module>
KeyboardInterrupt:
>>>
Code: Select all
MicroPython v1.8.3-24-g095e43a-dirty on 2016-08-15; F4DISC with STM32F407
Type "help()" for more information.
>>> import ctrlc
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "ctrlc.py", line 14, in <module>
KeyboardInterrupt:
>>>
-
- Posts: 22
- Joined: Sat Jun 20, 2015 11:48 am
Re: KeyboardInterrupt Ctrl+c does not work
what happened if you don't use Switch Button. I'm using STM32F407 on my modified Board similar to Discovery Board without Switch.
Before built, i've disabled has_switch to 0 on mpconfig, I think, it would nothing happen if you press ctrl +c during while loop without using switch button there.
Before built, i've disabled has_switch to 0 on mpconfig, I think, it would nothing happen if you press ctrl +c during while loop without using switch button there.
Re: KeyboardInterrupt Ctrl+c does not work
Control-C also worked for me without using the switch code. I even compiled with MICROPY_HW_HAS_SWITCH set to zero.
Control-C doesn't work if your REPL is on a UART but it should be working fine if your REPL is on the USB-serial.
2 reasons why Control-C might not be getting processed:
1 - Interrupts have been disabled
2 - Some interrupt is firing continuously.
Control-C doesn't work if your REPL is on a UART but it should be working fine if your REPL is on the USB-serial.
2 reasons why Control-C might not be getting processed:
1 - Interrupts have been disabled
2 - Some interrupt is firing continuously.
-
- Posts: 22
- Joined: Sat Jun 20, 2015 11:48 am
Re: KeyboardInterrupt Ctrl+c does not work
It works fine, when i switched to the old commit 27.07.2016 with same mpconfig and same code. I think it's a bug. Strange
the code ist simple
the code ist simple
Code: Select all
while 1:
print('hello')
pyb.delay(100)
Re: KeyboardInterrupt Ctrl+c does not work
That seems to work fine for me as well:
Have you tried building with the latest tree?
Code: Select all
MicroPython v1.8.3-24-g095e43a on 2016-08-15; F4DISC with STM32F407
Type "help()" for more information.
>>>
>>> import ctrlc
hello
hello
hello
hello
hello
hello
hello
hello
hello
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "ctrlc.py", line 5, in <module>
KeyboardInterrupt:
>>>
-
- Posts: 22
- Joined: Sat Jun 20, 2015 11:48 am
Re: KeyboardInterrupt Ctrl+c does not work
recent built of micropython did not work as always, then converted again same firmware.elf to prog.bin. After flashing, ctrl+c does work.
I'm confused, Is it something wrong with objcopy?
I'm confused, Is it something wrong with objcopy?
Code: Select all
arm-none-eabi-objcopy -O binary firmware.elf prog.bin
st-flash write prog.bin 0x8000000
Re: KeyboardInterrupt Ctrl+c does not work
I don't understand the difference between your working and non-working scenarios. Were they both flashed the same way?
-
- Posts: 22
- Joined: Sat Jun 20, 2015 11:48 am
Re: KeyboardInterrupt Ctrl+c does not work
Yes they were both flashed same way,dhylands wrote:I don't understand the difference between your working and non-working scenarios. Were they both flashed the same way?