10 years, 6 months ago.

What is the source code for LPC812Max and RaspberryPi serial connection ?

The idea came to me after the inability to run program by serial pc running virtual USBrx/tx.

---------

  1. include "mbed.h"

int main( ... ) { int aVar = 10; Serial pc(USBTX, USBRX); tx, rx pc.printf( "Hello world! %d\n\r", aVar ); } -----------

My goal is to connect the GPIO Raspberry-pi interface, using 3.3Volt output, ground, and RX / TX via the level shifter, on my LPC812Max : 5 volt, ground and the digital arduino compatible TX/RX (0,1).

I physically connect, and that's ok, with minicom installed.

I tried this, but I have a flood of errors ...

---------------- include "mbed.h"

  1. include "BufferedSerial.h"

BufferedSerial pc(USBTX, USBRX);

int main() { pc.baud(115200);

while(1) { Timer s;

s.start(); pc.printf("Hello World - buff\n"); int buffered_time = s.read_us(); wait(0.1f); give time for the buffer to empty

s.reset(); printf("Hello World - poll\n"); int polled_time = s.read_us(); s.stop(); wait(0.1f); give time for the buffer to empty

pc.printf("printf buffered took %d us\n", buffered_time); pc.printf("printf polled took %d us\n", polled_time); wait(0.5f); } }

-----------------

I saw that we could define the connections of wires, but in this case, there is no mention of TX and RX, present in the digital output lpc812 (0 and 1)

----------------- 00001 example showing sending/receiving character 00002 00003 #include "mbed.h" 00004 00005 connect p9 to p14 with a wire! 00006 Serial out(p9, NC); 00007 Serial in(NC, p14); 00008 00009 DigitalOut led(LED1); 00010 00011 int main() { 00012 out.putc('h'); 00013 out.putc('i'); 00014 char c1 = in.getc(); 00015 char c2 = in.getc(); 00016 00017 led = 1; 00018 printf("c1: %c, c2: %c\n", c1, c2); 00019 }

---------------

This will be great if I could get the source code for my project.

/media/uploads/vuzzx3/img_20131016_163822.jpg

/media/uploads/vuzzx3/img_20131016_154929.jpg

Thanks.

Put your code between code tags: <<code>> and <</code>>

Also you say you get errors, which errors do you get? Also I see you use different objects for your serial input and output, why not just use one? On other mbeds it should work, but the LPC800 is special in the way it connects peripherals to pins, so it might be problematic.

posted by Erik - 16 Oct 2013
Be the first to answer this question.