reading terminal using processor expert component

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

reading terminal using processor expert component

1,506 Views
martinboton
Contributor I

Hi, I'm trying to read a line or a char in a terminal but it seems nothing is happening when im typing in the terminal. I'm using processor expert TERM component.

Here is a part of my code :

 

  char readchannel;

  Term1_SendStr("select DAC channel (0, 1, 2, 3) :\r\n");

  Term1_ReadChar(&readchannel);

 

The "send" function works well but I dont get why I cant read anything...

Would you guys help me with this ?

 

Regards,

 

Martin

Labels (1)
0 Kudos
Reply
10 Replies

1,148 Views
martinboton
Contributor I

Hi David,

It does work now, thank you very much.

I noticed that it also works if I create a Processor Expert project with the microprocessor selected in the settings instead of the board itself. So the issue probably comes from KDS and project generation for the FRDM K64F.

Regards,

Martin

0 Kudos
Reply

1,148 Views
DavidS
NXP Employee
NXP Employee

Hi Martin,

My apologizes.  I left one of my edits out of the previous text file with the modifications.

Here it is updated (i.e. attached).

Regards,

David

PS

I worked for my with Hercules, Tera Term, and Putty.

0 Kudos
Reply

1,148 Views
DavidS
NXP Employee
NXP Employee

Hi Martin,

Yes I am getting characters back.

HELLO WORLD!!!

TERMINAL DEMO

HELLO WORLD!!!1

TERMINAL DEMO

HELLO WORLD!!!2

TERMINAL DEMO

HELLO WORLD!!!3

TERMINAL DEMO

HELLO WORLD!!!4

TERMINAL DEMO

HELLO WORLD!!!5

TERMINAL DEMO

HELLO WORLD!!!6

TERMINAL DEMO

HELLO WORLD!!!7

TERMINAL DEMO

HELLO WORLD!!!8

TERMINAL DEMO

HELLO WORLD!!!

The above output is when I type "0 1 2 3 4 5 6 7 8" in the terminal window.

Note as mentioned in source code that first character not echoed back but rest of them are.

Slightly updated main().

Regards,

David

0 Kudos
Reply

1,148 Views
martinboton
Contributor I

Hi David,

It still doesn't work for me... Which terminal software are you using ?

Regards,

Martin

0 Kudos
Reply

1,148 Views
DavidS
NXP Employee
NXP Employee

Hi Martin,

Please look at following link:

https://mcuoneclipse.com/2013/11/16/tutorial-using-a-terminal-input-and-output-without-printf-and-sc...

Then search for "Term1_ReadChar" on the page.

The 3rd entry has following:

Hi Shaul,
thanks for your kind words, appreciated:-)
– Where/how do you see that speed limit of 1200 baud? I’m not aware of such a thing.
– ‘Device’ vs. ‘Board’: I think you mean selection at project creation time? Yes, I have seen this, and this is a bug in the wizard to my knowledge. There should be a 3.0.1 update (Help > Install new software and then select the KDS site) to fix this. I had no time to verify this, but this is what I was told.
– ReadChar(&ch): yes, it blocks until it reads a character. Use first Term1_KeyPressed() to find out if there is a character present, and only then call Term1_ReadChar().
– As for CR-LF: this is an option in Termite to define what shall happen if you press key in the Termite input field.

I hope this helps,
Erich

Regards,

David 

0 Kudos
Reply

1,148 Views
martinboton
Contributor I

Hi David,

Thank you very much for your quick answer.

I tried to use first KeyPressed() then call ReadChar() but it still doesn't work.

I saw there was some kind of bug with the FRDM K64F and KDS, could it come from there ?

Regards,

Martin

0 Kudos
Reply

1,148 Views
DavidS
NXP Employee
NXP Employee

Hi Martin,

Yes I think something not right.  Not certain if hardware or software for K64.  The UART gets configured to use FIFO mode and I'm not sure the drivers are really set up to use them.

I have somewhat of a workaround for you to try.

I create a new KDS_3.0 PE project for frdm-k64f (attached).  Once I had the Components configured I then made edits to some of the PE files and can compile without having PE update the source.

Summary of changes (search for "//DES" :

pastedImage_0.png

Before submitting a trouble ticket I want to test on other hardware and also get your feedback.

Regards,

David

0 Kudos
Reply

1,148 Views
martinboton
Contributor I

Hi David,

When I debug your project KDS replaces the files you modified in 'Generated_Code' folder with the originals I guess.

I am new to KDS and PE so I don't really what is going on...

Martin

0 Kudos
Reply

1,148 Views
DavidS
NXP Employee
NXP Employee

Hi Martin,

Yes it takes some time to get used to the tool.

I'm guessing that IMPORTing the project and then trying to compile might also re-build the PE source code.  On my side after I generated the PE code, I could then edit and compile the project without the PE code being regenerated.

You might need to re-peat those steps of re-generating the code, compile, debug/test....then go back and make the edits to source, re-compile (without generating PE code), then debug/test.

Attached is my cheat sheet of modified code you can use to copy-n-paste.

Regards,

David

0 Kudos
Reply

1,148 Views
martinboton
Contributor I

Hello David,

Indeed if I re-generate PE code then edit, compile and debug then go back the code remains and can be compiled without regenerating PE code. But I still can't read a char, Term1_ReadChar() is blocking. Does it work on your side ?

Regards,

Martin

0 Kudos
Reply