I am working on LM3S8962 and need to write a program to comunicate with PC via UART. I use Labview inline C node to write codes using ARM_Serial.c which is from Keil Software.
The file has
int ARM_Serial_InitPort (int serDevNo, unsigned long baudrate, unsigned int databits, unsigned int parity, unsigned int stopbits) int ARM_Serial_Write (int serDevNo, const char *buffer, int *length)
I tried to use them to control serial port, but it didn't work well. I used U0TX, U0RX and GND pins on micro controller to connect to a serial port in PC.
I couldn't find any information about ARM_Serial_InitPort and ARM_Serial_Write functions on the internet. Any information or tips about it would be very appreciatted.
Thank you.
Masa
I realized that I forgot to use ARM_Serial_OpenPort to open a serial port. Using the function, now it is communicating via serial port, however, characters get garbled. Is there any mistake?
int ret; // PortNumber, serialDeviceNumber=PortNumber+1 ret = ARM_Serial_OpenPort(1,2); //serialDeviceNumber, Baud, DataBits, Parity, StopBits ret = ARM_Serial_InitPort(2, 9600, 7, 0, 1); //write data to serial int l = 5; int ret; char *x; x="abcd"; ret = ARM_Serial_Write(2, x, &l);
Did you intend to use 7-bit transfers?
Have you verified baudrate with an oscilloscope?
I tried 7-bid, but It didn't work.
>Have you verified baudrate with an oscilloscope? Not yet. I will check it.
You _tried_ 7-bit?
But your posted code contains:
ret = ARM_Serial_InitPort(2, 9600, 7, 0, 1);
Isn't that the configuration for 7-bit data?
I tried both 7 bit and 8 bit.
I should have posted the code with 8 bit.