Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Serial Port setup (45k50)
06-10-2014, 09:50 AM, (This post was last modified: 06-10-2014, 09:53 AM by GastonLagaffe.)
#1
Serial Port setup (45k50)
Salut,
as I try to do get used to the pinguino step by step, I thought I try to talk to it using the serial port. I identified the pins for TX/RX (25,26) and connected them crossed to a RS232/USB adapter (FOCA from itead). I then used a simple code to write to the serial port:
Code:
void setup() {
   //run once:
   Serial.begin(9600);
   }

void loop() {
   //run repeatedly:
   Serial.printf("Hello\n");
   delay(500);
   }
I see on the RX/TX leds of the FOCA that I get something on the RX line of the foca ever 500 ms. Typing in the serial terminal program lights the TX line. So all looks ok. Unfortunately I do not see anything on the serial terminal.
The port settings are:
Baud: 9600
data: 8-bit
parity: none
stop: 1-bit
flow control: none (also tried xon/xoff and hardware without success)
As I see the RX line pulsing with the Serial.printf command, it must be something simple I am overlooking

Ciao, Mathias
(Sorry for the perhaps stupid questions but I am absolutely fresh on the Pinguino)
PIC18F45k50 kit, Windows7, pinguino 10.4 and 11.x
Reply
06-10-2014, 11:48 AM,
#2
RE: Serial Port setup (45k50)
(06-10-2014, 09:50 AM)GastonLagaffe Wrote: Salut,
I tried your example on X.4 and V11 and it works.
The only difference I use a true RS232 line with an adapter 5V (made with 2 transistors).
Try to switch between RX and TX on your USB adapter.
Bye André
Reply
06-10-2014, 12:52 PM,
#3
RE: Serial Port setup (45k50)
(06-10-2014, 11:48 AM)gtcbreizh Wrote: Salut André,

if I swap the RS232 adapter and it works now! Looks like a hardware problem with that adpater.
Tested speed up to 921600 baud ... 8 times faster than arduino Wink

Tanks for the fast reply,
Mathias
Reply
06-10-2014, 05:05 PM, (This post was last modified: 06-10-2014, 05:05 PM by GastonLagaffe.)
#4
RE: Serial Port setup (45k50)
Salut André,

just that you get an impression what I am trying to achieve:
I have a windows application that acts like a dashboard for microcotrollers. I started this with arduinos and now want to use it with the pinguino. Attached is a screenshot of the working bink demo. It shows the identified board on the right side and the running sketch on the bottom left. The demo lets a RGB LED blink in the different colors.

The dashboard provides buttons, output labels, sliders, radio buttons, checkboxes, comboboxes and the possibility to chart data linear, polar and as histograms.

I will keep you posted with the progress

Ciao Mathias
PS: the dashboard currently runs on windows only (.net) but the wx_python version is on its way


Attached Files Thumbnail(s)
   
Reply
06-10-2014, 08:04 PM,
#5
RE: Serial Port setup (45k50)
Salut Mathias,
Is it possible to see more in the Arduino context ? I own a Duemilanove ATmega328 which I appreciate very much.
From my side I worked with Python, PySide and a 47J53 using some elements in Arduino firmata. See attached capture
Bye
André.


Attached Files Thumbnail(s)
   
Reply
07-10-2014, 10:11 AM,
#6
RE: Serial Port setup (45k50)
(06-10-2014, 08:04 PM)gtcbreizh Wrote: Salut André,

the communication protocol is a very simple one and not limited to the arduino. Here the code of a simple histogram demo:

Code:
void setup() {
// start the serial interface
Serial.begin(115200);
while (!Serial) {
  ; // wait for serial port to connect. Needed for Leonardo only
}
Serial.println(">START<");
Serial.println(">BRD.NANO<"); // identify yourself with the right board (UNO, LEONARDO, MEGA, NANO, P45K50)
Serial.println(">IFO.Histogram Demo Sketch 1.0.0<"); // Who are we
Serial.println(">TTL1Dashboard Demo - Histogram Test<"); // Demo Title to be displayed
Serial.println(">HTM001.0000.1200<"); // Histogram x-axis minimum and maximum
Serial.println(">HTZ001<"); // set Histrogram data to zero
}

void loop() {
// put your main code here, to run repeatedly:
int val;
val = analogRead(1);
Serial.print(">HTV001.");
Serial.print(val);
Serial.println("<");
delay(50);
}
This is a non-interactive demo, so the arduino sends the setup information to the dashboard to identify itself and the sketch name, then requests a title on the first screen and initializes the histogram. In the loop, it simply sends the data (HTV=HisTogram Value). The dots are only there for the human user to make the protocol readable. I know this is a waste of bytes but I find this nicer for debugging.
The outcome is attached as well as other screenshots. I am currently writing the documentation but this is time consuming ...
The histogram demo displays static noise on A1. The second demo shows control items of an interactive demo, the third shows the timeline plot of up to 6 sources plus the possibility to send time stamps and the last one shows polar data.

Ciao,Mathias


Attached Files Thumbnail(s)
               
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)