TOP
SSV Software Systems Register  Register
Log in to check your private messages  Log in to check your private messages
Startseite FAQ Search Mitglieder Profile  Log in 
SSV Support-Forum
ttyS(x) to UART(x) mapping

 
Post new topic   Reply to topic    SSV-Forum Forum Index >>> DNP/9200
<<< Previous topic - Next topic >>>  
Display posts from previous:   
Author Message
sgs



Joined: 27 Jul 2009
Posts: 1

PostPosted: 05.02.2010, 10:35    Post subject: ttyS(x) to UART(x) mapping Reply with quote

I am trying to understand the mapping between the ttySx and the processor USARTs

I see the following defined in the board-dnp9200.c file

static struct at91_uart_config __initdata dnp9200_uart_config = {
.console_tty = 0, /* ttyS0 */
.nr_tty = 3,
.tty_map = { 1, 2, 4, -1, -1 } /* ttyS0, ..., ttyS4 */
};

This means that ttyS0 is connected to USART1, ttyS1 to USART2, ttyS2 to USART4 and ttyS3 to -1 and ttyS4 to -1

But nr_tty is limited to 3, which means only 3 ttyS will be allowed (??), then why define them in the tty_map at all?

Also the processor AT91RM9200 has no USART4, so where is ttyS2 connected?
Back to top
View user's profile Send private message
hne



Joined: 11 Jul 2008
Posts: 210
Location: Hannover

PostPosted: 10.02.2010, 16:09    Post subject: Re: ttyS(x) to UART(x) mapping Reply with quote

You have 3 devices ttyS0, ttyS1 and ttyS2. With a short look into kernel source arch/arm/mach-at91rm9200/devices.c you would see the answer in function at91_init_serial:
MAP number 4 is the debug port, there ttyS2 is connected.

And why all 5 maps and only 3 used? Answer: All ARM drivers in standard Linux kernel does it. We assume some older drivers access the map without check the "nr_tty". So, this source is the safe way.
_________________
Henry Nestler
Back to top
View user's profile Send private message Visit poster's website
telmocho



Joined: 21 Dec 2009
Posts: 3

PostPosted: 04.10.2010, 11:00    Post subject: Reply with quote

Hallo,
I've modified your ssvrs485.ko driver to work with usart3 and ttys2, but it fails.
Well, after read your post, I've doubts.
I've rx and tx pins in PB6 and PB7 of DNP9200.
Should I open "/dev/ttyS2" and use USART3?? Or this is what I'm doing wrong and I've to modify something else. I say this because in the file that nhe post, ttyS2 link with usart4, where ir usart3?
Code:
/*
 * Serial port configuration.
 *    0 .. 3 = USART0 .. USART3
 *    4      = DBGU
 */
static struct at91_uart_config __initdata dnp9200_uart_config = {
   .console_tty   = 0,            /* ttyS0 */
   .nr_tty      = 3,
   .tty_map   = { 1, 2, 4, -1, -1 }      /* ttyS0, ..., ttyS4 */
};


I call init_portB and init_mem ( with a call to pPIO_BASE = pMapMemory(0xFFFFF000, 0x00001000) ),

Regards,
Telmocho.


EDIT: When I wrote "fails", I meant that I loose telnet communication with the device.
Back to top
View user's profile Send private message
telmocho



Joined: 21 Dec 2009
Posts: 3

PostPosted: 04.10.2010, 12:08    Post subject: Reply with quote

Ok, I found the problem.
I have to initializate, in init:mem():
Code:
   pUART3_BASE = (u32 *) pMapmemory (0xFFFCC000, 0x00004000);

and make a call to this function:
Code:
   void init_port_uart3 (void)
   {
      /* enable used PIOs */
      PIOA_ASR = AT91C_PA6_RXD3 | AT91C_PA5_TXD3;
      PIOA_PDR = AT91C_PA6_RXD3 | AT91C_PA5_TXD3;
      PIOA_BSR = AT91C_PA6_RXD3 | AT91C_PA5_TXD3;
   }

But I don't understand why, because with UART2 and ttyS1 it works without this pMapmemory.
Any clue?
Back to top
View user's profile Send private message
telmocho



Joined: 21 Dec 2009
Posts: 3

PostPosted: 06.10.2010, 10:58    Post subject: Reply with quote

This is very difficult.
I can write but I do not get any response!
Something without right initialization.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SSV-Forum Forum Index >>> DNP/9200 All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

SSV Software Systems GmbH

Dünenweg 5
30419 Hannover

Fon: +49(0)511  ·  40 000-0
Fax: +49(0)511  ·  40 000-40

sales@ssv-embedded.de


Impressum    ·    Datenschutz    ·    AGB

© 2023 SSV SOFTWARE SYSTEMS GmbH. Alle Rechte vorbehalten.

ISO 9001:2015