Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
9 years, 10 months ago.
use serial port
Hello
I need the use serial communication bitwen PC and u-blox C027. I want use port P4_28 and P4_27 for send data ( char ) to PC .
I have serial adapter USB to RS232 => MAX232 => port serial C027.
I have already looking on library serial "Serial pc(TX, RX);" . now i need the declaration of ports P4_28 and P4_27 for use it in code.
thanks
Question relating to:
1 Answer
9 years, 10 months ago.
P4_28 and P4_27, exactly as you say. Although doesn't it have a USB port on it already which you can use for exactly this? And if you want to use a seperate USB <> Serial adapter, there are also many which directly go to TTL voltage levels, so you don't have to let it make RS232 levels, and then convert that against to TTL levels.
thanks for your answer .
I use now an adapter USB to serial + MAX232 + serial port on C027 P4_28 and P4_29
schema :
http://img11.hostingpics.net/pics/913876schema.png
code :
#include "mbed.h" #ifdef TARGET_UBLOX_C027 #include "C027_api.h" #else #error "This example is targeted for the C027 platform" #endif DigitalOut myled(LED); // open the PC serial port and (use the same baudrate) Serial pc(D1,D0); int main() { while (1) { myled = !myled; wait(0.05); pc.printf("test\n"); } }
but I can't receive data .
posted by 21 Jun 2014So which pins are D1 and D0? On standard Arduino layout they are USBTX and USBRX, so you should just be able to receive it via the USB connector, no need to bother with an external adapter. Just make sure you install the drivers you require. https://mbed.org/handbook/SerialPC
posted by 21 Jun 2014