Forum Discussion
Altera_Forum
Honored Contributor
11 years agonios2-terminal command line
Hi Im trying to issue a set of commands to my nios using the jtag-uart. I can open up the command shell, type nios2-terminal, issue my command and then type ctrl-c and close the terminal. I c...
Altera_Forum
Honored Contributor
11 years agook, figured this out and wanted to post it for others...
from a search on SF, the send control function might not work as expected. So the guy recommended that the poster use just send send('\003') instead of sendcontrol('c'). '\003' being the ascii for cntrl c so i tried that. didnt work. then i saw another mention on these forums that to escape nios2-terminal, i actually need to send a cntrl-D so i tried that. no luck then i sent another couple of sendline(deadbeefs) and tried to readline() well, in the response back from readline, i saw that nios2-terminal had closed in response to cntrl-d So the trick is.... after sending the cntrl-d ascii, i needed to "flush buffer" with a send line. I then modified the code to replace "SC.sendcontrol('c') to 'SC.sendline('\004') and bam, it worked so it should be: from winpexpect import winspawn import time SC=winspawn("C:/altera/13.0/nios2eds/Nios_II_Command_Shell.bat") SC.expect('$') SC.sendline('nios2-terminal') time.sleep(5) SC.sendline('deadbeef;') SC.sendline('\004') hope this helps someone!