Hi
I'm trying to linking a serial port to the Uart 2 of my M52259Demokit. To do this, I'm using an USB-Serial converter that I've linked to the pins of the Uart 2. The problem is that I'm commiting any error because my application can't read or write this new Uart. I will explain you step by step all my efforts:
1. Reading in the documentation about M52259Demokit, I've found that the Uart2 is mapped in the ports 3, 9 and 11 (no flow control) of J4 in the M52252DemoCom board.
2. My USB-Serial converter dispose 6 pins. I've connected 3 of its pins following this schema:
Tx Usb-Serial - Pin Urxd2 (RX Uart)
Rx Usb-Serial - Pin Utxd2 (TX Uart)
GND Usb-Serial - Pin GND Uart
3. I've opened two hyperterminals. The first connected to the Uart 0 (the serial port which includes the board), and to my USB-Serial port, using one of my computer's usb ports.
4. To test my connection, i've created a new project, and in the main application I've created an application which makes an echo in the serial port. The code, is something like this.
uart_init (2, SYSTEM_CLOCK_KHZ, baudRate);
while (1){
c=uart_getchar(2);
uart_putchar(2,c);
}
Of course, my application runs correctly using the uart 0, but doesn't run using the uart 2.
Could you help me? Do you have any suggestion? I'm guessing that it's probably that, althought my application is correct, I haven't configured correctly the uart ports, because these ports are shared with another functions, like the CAN port, but reviewing my code, and my connections, I can't see where's my error.
Could you help me please???? I'm despereting!
Thanks you in advance
Hi another time
First of all, thanks you for your quicky reply. I'll check your web as soon as I could make run my Uart! :smileysad:
I've been one whole day trying to make run my Uart, but doesn't work yet. Effectively, the main problem of my application was that the pin assignement was incorrect. With your explanation about PUCPAR I've been able to configure correctly these pinout, but doesn't work correctly.
I've created a little application which all data received from Uart2 is send to Uart0, and newly to Uart2 (like a echo). But, the problem is all data received in Uart0 is corrupted (like if it was send with a different speed. Also, no data is received in Uart2.
If you could help me, you can find my source in the attachment file. All suggestions will be welcome.
Thanks you in advance.
Hi, if you connect MCU's UART2 pins to USB-Serial converter directly without using MAX3232(etc)?
Hi
Well, I'm using this component to use the Uart: http://www.ftdichip.com/Documents/DataSheets/Modules/DS_USB-RS232_PCB_V101.pdf (default configuration)
As I know, these voltage levels would be the same used in my board, but I'm starting to think that perhaps is here where's the problem.
mmmmm..... thanks you a lot of.
I'll test it tomorrow (I don't have my board here right now), but I think I have to read with more depth the documentation about Coldfire. :smileysad: Searching in the documentation I think your suggestion could be the solution to all my troubles.
By the way: do you have any other instructive example working with uarts?
Thanks you a lot of.
Hi
You could look at the uTasker project since it contains a lot of things which will probably be useful to you. The UART driver supports all available UARTs in interrupt and DMA mode, with XON/XOFF or RTS/CTS flow control and RS485 modes - see http://www.utasker.com/docs/uTasker/uTaskerUART.PDF
In addition you can simulate the Kirin3 and check the port configuration; see some screen shots here:
http://www.utasker.com/Demos/Simulations.html
and map the simulated UARTs to PC COM ports to test real communication, for example.
Regards
Mark
Hi
UART2 can be configured to be one of 3 different port locations.
To match the M52259DEMO board you need to ensure that you configure it on port UC with something similar to this:
PUCPAR |= ((PRIMARY_FUNCTION_Q << BIT_0_Q_SHIFT) | (PRIMARY_FUNCTION_Q << BIT_1_Q_SHIFT)); // set TX/RX on UC
(This is the value 0x05)
Regards
Mark
www.uTasker.com
- OS, TCP/IP stack, USB, device drivers and simulator for M521X, M521XX, M5221X, M5222X, M5223X, M5225X. One package does them all - "Embedding it better..."