Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Getkey + change UART
01-03-2012, 10:47 PM,
#1
Getkey + change UART
PinGuino: X.2 rev 240
OS: XP SP3
Board: PIC32 Pinguino Micro
Terminal: TeraTerm 4.67

Problem 1: Example "4. Communications / Serial / getkey.pde":
  • printf works.
  • getkey gives no response ( I can see with a scope a char is going into Rx).

Problem 2: How can I manage that printf and getkey works on UART2.


Reply
02-03-2012, 10:26 AM,
#2
RE: Getkey + change UART
I found the CDC stuff works so used that.

John
Reply
03-03-2012, 06:16 PM,
#3
RE: Getkey + change UART
I went to my cardealer with my complaint: "My reverse don't work".
"Oh", he replied, "Drive the car in forward, that works !".
Thanks.
So, my question is still valid.

(02-03-2012, 10:26 AM)pingotg Wrote: I found the CDC stuff works so used that.

John

Reply
03-03-2012, 06:51 PM, (This post was last modified: 03-03-2012, 06:51 PM by pingotg.)
#4
RE: Getkey + change UART
This stuff is free. You choose whether to use it. No warranty and you didn't pay for it.

See if you can get the car for free. Then see if you can get reverse fixed free if it doesn't work.

John
Reply
03-03-2012, 08:23 PM,
#5
RE: Getkey + change UART
Hi Henk,

could you confirm which version of the Pinguino IDE you are using as your original post said you were using "PinGuino: X.2 rev 240" whereas support for the PIC32 Pinguino Micro did not start to be introduced till r268 and there have been several changes since then. I would suggest updating to the latest full version for Windows from the Google Code page (http://code.google.com/p/pinguino32/downloads/list).

Also, assuming you are compiling in the Pinguino IDE, which board do you have selected under menu Preferences >> Board ?

Regards

Mark
Board = PIC32-Pinguino-OTG Rev C
OS = Linux Unbuntu 11.10 till 26 Apr 2012
OS = Linux Unbuntu 12:04 from 27 Apr 2012
Reply
03-03-2012, 10:36 PM,
#6
RE: Getkey + change UART
PinGuino: X.2 rev 291
OS: XP SP3
Board: PIC32 Pinguino Micro
Terminal: TeraTerm 4.67


Hi mf01,

I've updated so now I'm working with x.2 rev 291.
I've chosen for board "Pic32 Pinguino Micro" under Preferences.
I've taken the example "examples/4.communication/serial/getkey.pde".
The problem persists: Serial.printf works on UART1, getkey doesn't.
Working with CDC gives no problem.

Problem 2: "How can I manage that printf and getkey works on UART2."
is not solved yet.

(03-03-2012, 08:23 PM)mf01 Wrote: Hi Henk,

could you confirm which version of the Pinguino IDE you are using as your original post said you were using "PinGuino: X.2 rev 240" whereas support for the PIC32 Pinguino Micro did not start to be introduced till r268 and there have been several changes since then. I would suggest updating to the latest full version for Windows from the Google Code page (http://code.google.com/p/pinguino32/downloads/list).

Also, assuming you are compiling in the Pinguino IDE, which board do you have selected under menu Preferences >> Board ?

Regards

Mark

Reply
04-03-2012, 12:16 PM,
#7
RE: Getkey + change UART
Hi Henk,

just for my information what circuit/components are you using for the level change between the RS232 interface and the PIC32 input/outputs ?

With the health warning that I have no experience of using the serial input/outputs but looking at the various Pinguino files, I think you could access UART2 just by changing the code in the example replacing all instances of "serial." with "serial2." so that the example becomes :-

Code:
void setup()
{
    Serial2.begin(9600);
}

void loop()
{
    u8 c;
    
    Serial2.printf("Please, press a key\n");
    c = Serial2.getkey();
    Serial2.printf("You pressed key [%c]\n",c);
}

I would be interested to know whether this works for UART2, i.e. whether you get no response, you get the same response as you did for UART1 (output but no input) or you get both output and input.

Regards
Board = PIC32-Pinguino-OTG Rev C
OS = Linux Unbuntu 11.10 till 26 Apr 2012
OS = Linux Unbuntu 12:04 from 27 Apr 2012
Reply
04-03-2012, 01:14 PM,
#8
RE: Getkey + change UART
Syntax should be Serial.getKey ...
By the way Serial.function = Serial1.function = Serial on UART1 ...
You can also use Serial2 (UART2) and up to Serial6 depending on the PIC32MX you have.
It is easier to complain than it is to do, but it is better to do than it is to complain.
Reply
04-03-2012, 01:24 PM,
#9
RE: Getkey + change UART
Thanks mf01,

I use a max232 for converting to RS232 level which I connect to COM1
on my PC. This COMport I can watch with Teraterm. At the Rx-line on the pinguino board I can watch the incoming signal from Teraterm with a logic state analyzer. There is a signal when I press a key.

You are right, I changed the example "getkey.pde" into the code you suggested and yes, serial2.printf works and no, serial2.getkey doesn't.
So my problem how to use UART2, which is connected to the UEXT connector, is solved now.
However, getkey persists as a problem.


(04-03-2012, 12:16 PM)mf01 Wrote: Hi Henk,

just for my information what circuit/components are you using for the level change between the RS232 interface and the PIC32 input/outputs ?

With the health warning that I have no experience of using the serial input/outputs but looking at the various Pinguino files, I think you could access UART2 just by changing the code in the example replacing all instances of "serial." with "serial2." so that the example becomes :-

Code:
void setup()
{
    Serial2.begin(9600);
}

void loop()
{
    u8 c;
    
    Serial2.printf("Please, press a key\n");
    c = Serial2.getkey();
    Serial2.printf("You pressed key [%c]\n",c);
}

I would be interested to know whether this works for UART2, i.e. whether you get no response, you get the same response as you did for UART1 (output but no input) or you get both output and input.

Regards

Reply
04-03-2012, 01:31 PM,
#10
RE: Getkey + change UART
(04-03-2012, 01:14 PM)regis Wrote: Syntax should be Serial.getKey ...
By the way Serial.function = Serial1.function = Serial on UART1 ...
You can also use Serial2 (UART2) and up to Serial6 depending on the PIC32MX you have.

Hi Regis,

are you sure about the syntax as pserial.pdl32 includes :-
Code:
Serial.getkey serial1getkey#include <pinguinoserial1.c>

and pserial1.pdl32 includes :-
Code:
Serial1.getkey serial1getkey#include <pinguinoserial1.c>

Serial.getKey only exists in serial.pdl32 as :-
Code:
Serial.getKey SerialGetKey#include <serial.c>

Regards
Board = PIC32-Pinguino-OTG Rev C
OS = Linux Unbuntu 11.10 till 26 Apr 2012
OS = Linux Unbuntu 12:04 from 27 Apr 2012
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)