Main Site Documentation

G400 RLP and serial port mapping


#1

Hi,

I want to read and write from serial port with G400, using RLP.

I guess I need to access to USART0 / USART1 / USART2

Where can I find the mapping between board socket and those registers?

I am working with G400 HDR board and saw that:

UART - Socket 6 - COM3
UART - Socket 7 - COM1
UART - Socket 9 - COM4

I need to know for example that COM3 is USART0 and etc.


#2

@ shm3 - Here is the Datasheet to COM port map:

COM1: PA9, PA10 ~ DRXD, DTXD
COM2: PA0, PA1 ~ TXD0, RXD0
COM3: PA5, PA6 ~ TXD1, RXD1
COM4: PA7, PA8 ~ TXD2, RXD2
COM5: PC8, PC9 ~ UTXD0, URXD0
COM6: PC16, PC17 ~ UTXD1, URXD1


#3

I am not sure I understand.

In Hydra I had this method: (serial port connected to socket #7)

void debug_print1(unsigned char *str, int numOfBytes)
{
unsigned char *p = str;
while (numOfBytes–)
{
AT91C_BASE_US0->US_THR = *p++;
while ( (AT91C_BASE_US0->US_CSR & 2) == 0) ;
}
}

now in G400 when serial port connected to socket #6 (HDR board) I thought it should be:

void debug_print1(unsigned char *str, int numOfBytes)
{
unsigned char *p = str;
while (numOfBytes–)
{
USART0->US_THR = *p++;
while ( (USART0->US_CSR & 2) == 0) ;
}
}

am I miss something?


#4

@ shm3 - The COM port on socket 6 is COM3 which is TXD1/RXD1 which could be the equivalent of UART/USART1.


#5

Thanks!

for some reason this line is endless:

while ( (USART1->US_CSR & 2) == 0) ;

very similar code works for me in Hydra but not for G400…


#6

Any idea why this code doesnt work:

void debug_print1(unsigned char *str, int numOfBytes)
{
unsigned char *p = str;
while (numOfBytes–)
{
USART1->US_THR = *p++;
while ( (USART1->US_CSR & 2) == 0) ;
}
}


#7

@ shm3 - I am uncertain as to why that code does not work. Your best bet would be to consult the datasheet for the G400’s processor.