Atmel website | ARM Community | AVR freaks | Technical Support
Banner
 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 12 posts ] 
Author Message
 Post subject: AT91SAM9G45-EKES based board with external 16c550 Uart
PostPosted: Wed Dec 15, 2010 11:07 am 
Offline

Joined: Wed Dec 15, 2010 10:40 am
Posts: 9
Hi all. I've designed a board based on AT91SAM9G45-EKES which I had an external uart 16c550. In fact I need 4 AT91 UARTS + 1 external.
My external UART is on CS5 (PC11) and INT is PC17 (low_level active).
When I add 16C550 uart the kernel does not detect anymore ATMEL UARTS and the system crashes :

VFS: Mounted root (nfs filesystem) on device 0:14.
Freeing init memory: 248K
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c0004000
[00000000] *pgd=00000000
Internal error: Oops: 5 [#1] PREEMPT
Modules linked in:
CPU: 0 Not tainted (2.6.30_scu6V3 #19)
PC is at tty_open+0x194/0x42c
LR is at tty_open+0x100/0x42c
pc : [<c015f608>] lr : [<c015f574>] psr: 60000013
sp : c7817e88 ip : 0000001f fp : c0319df8
r10: c740e9b0 r9 : 00000000 r8 : c7816000
r7 : 00000001 r6 : 00500001 r5 : c7873ec0 r4 : c79ab840
r3 : 00000000 r2 : 00000000 r1 : 00000000 r0 : c79ab844
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 0005317f Table: 70004000 DAC: 00000017
Process swapper (pid: 1, stack limit = 0xc7816268)
Stack: (0xc7817e88 to 0xc7818000)
7e80: 00500001 00000002 c00b31dc 00000000 c7817ec4 c740e9b0
7ea0: c7873ec0 c0333d60 00000000 00000000 00000000 00000000 00000000 c00b36cc
7ec0: c740e9b0 00000000 c7873ec0 c740e9b0 c780a1a0 c00b3504 c7401f18 c00ae9c0
7ee0: c7873ec0 c7873ec0 c7814660 c7817f30 00000000 c78da000 00000001 c00aeba4
7f00: 00000000 c7814660 00000026 00000003 00000026 c00bbe90 00000000 00000002
7f20: 00000000 c7817fb4 00000006 00000000 c780a1a0 c7401f18 c7817f68 80000013
7f40: 60000093 00000101 00000001 00000000 c78da000 c0020ce0 c7817fd0 00000000
7f60: 00000003 c00bb988 c780a1a0 c7405c38 c033e400 00000003 00000000 c7873ec0
7f80: c7815bc0 00000000 00000002 c7815bc4 00000000 00000000 ffffff9c 00000000
7fa0: 00000000 c78da000 00000000 00000000 00000000 c00ae78c 00000000 c02b3de4
7fc0: 00000002 c03288c0 c0020ce0 00000000 00000000 00000000 00000000 c0046444
7fe0: c03288c0 c0008598 c0061980 00000000 00000000 c0061980 212a1a22 7ded1dee
[<c015f608>] (tty_open+0x194/0x42c) from [<c00b36cc>] (chrdev_open+0x1c8/0x1e4)
[<c00b36cc>] (chrdev_open+0x1c8/0x1e4) from [<c00ae9c0>] (__dentry_open+0x180/0x29c)


Any idea or example with this kind of hardware?

Thank you


Top
 Profile  
 
 Post subject: Re: AT91SAM9G45-EKES based board with external 16c550 Uart
PostPosted: Wed Dec 15, 2010 6:43 pm 
Offline

Joined: Wed Dec 15, 2010 10:40 am
Posts: 9
Hi all. OK my kernel does not crash anymore . I had to select the option what uses ttyATx instead of ttySx for ATMEL UARTS.
But my kernel doesn't detect my external UART.

Does anyone have an example to setup this uart with my CS?

Thank you.
Regards


Top
 Profile  
 
 Post subject: Re: AT91SAM9G45-EKES based board with external 16c550 Uart
PostPosted: Thu Dec 16, 2010 6:12 pm 
Offline

Joined: Wed Dec 15, 2010 10:40 am
Posts: 9
Hi all, I've solved my trouble, i was the smc timings which were wrong.

Bye


Top
 Profile  
 
 Post subject: Re: AT91SAM9G45-EKES based board with external 16c550 Uart
PostPosted: Wed May 18, 2011 2:59 pm 
Offline

Joined: Sun Apr 17, 2011 5:44 pm
Posts: 11
I had a similar problem and it was solved using correct smc timings and putting
Atmel USARTS in ttyATX form.

But I am trying to use two serial port and first one (COMA) is selected by NCS1/
SDCS1 and second (COMB) serial is selected by NCS2, this board is already built
in this way.

After kernel detect this serial:

Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
serial8250.1: ttyS0 at MMIO 0x30000000 (irq = 97) is a 16550A

COMA is outputting random data all time and COMB doesn't work! The kernel doesn'
t show COMA at boot time, CSA from TL16C2550 is connected on NCS1 which would be
mapped at MMIO 0x20000000 and it doesn't happen.

Is there special careful about NCS1/SDCS1 pin?

Could you show your source code?

Our board is based on AT91sma9g45-ekes too.


Top
 Profile  
 
 Post subject: Re: AT91SAM9G45-EKES based board with external 16c550 Uart
PostPosted: Tue May 24, 2011 9:14 pm 
Offline

Joined: Thu Nov 04, 2010 9:50 pm
Posts: 7
Hi seb2000

I can't make make may external UART work.

Could you please post/send me the part of the code you did to make itl work?

Thank In Advance,
Edgard


Top
 Profile  
 
 Post subject: Re: AT91SAM9G45-EKES based board with external 16c550 Uart
PostPosted: Wed May 25, 2011 3:32 pm 
Offline

Joined: Sun Apr 17, 2011 5:44 pm
Posts: 11
Trying with long NCS_PULSE some random data are output at boot time.

For this test sam9_smc_config was:

static struct sam9_smc_config tms_uart_smc_config = {
.ncs_read_setup = 0,
.nrd_setup = 2,
.ncs_write_setup = 0,
.nwe_setup = 2,

.ncs_read_pulse = 200,
.nrd_pulse = 4,
.ncs_write_pulse = 200,
.nwe_pulse = 3,

.read_cycle = 209,
.write_cycle = 207,

.mode = AT91_SMC_READMODE | AT91_SMC_WRITEMODE | AT91_SMC_EXNWMODE_DISABLE | AT91_SMC_DBW_8 | AT91_SMC_BAT_WRITE,
.tdf_cycles = 1,
};

Are there any trick for UART timing?


Top
 Profile  
 
 Post subject: Re: AT91SAM9G45-EKES based board with external 16c550 Uart
PostPosted: Wed May 25, 2011 5:30 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 574
Here's a thought.

Add pin configuration and EBI timing code into AT91Bootstrap.
Add test code to read/write the 16C550 registers interactively, via the the DBGU console.
Add test code to loop around.
Upload and run the code in SRAM with SAM-BA.
Stick a scope on the 16C550 select/read/write pins.
Observe.
Compare to datasheets.
Debug.

Once you understand what's happening, and how it works in a simple to validate environment you can migrate that knowledge into your kernel setup.


Top
 Profile  
 
 Post subject: Re: AT91SAM9G45-EKES based board with external 16c550 Uart
PostPosted: Fri May 27, 2011 5:11 pm 
Offline

Joined: Sun Apr 17, 2011 5:44 pm
Posts: 11
I hope it isn't time problem, because linux kernel is talking with uart at boot time:

Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
ttyS0: autoconf (0x0000, 0xc8860000): iir=3 iir1=6 iir2=6 type=16550A
serial8250.0: ttyS0 at MMIO 0x20000000 (irq = 96) is a 16550A
ttyS1: autoconf (0x0000, 0xc8864000): iir=3 iir1=6 iir2=6 type=16550A

Something happen after that and no data is output on serial line, we are using getty for test and looking osciloscope CS and WE are ok.

Is 0xc8860000 a valid address for memory map?


Top
 Profile  
 
 Post subject: Re: AT91SAM9G45-EKES based board with external 16c550 Uart
PostPosted: Fri May 27, 2011 5:23 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 574
It's via the MMU, it says the MMIO is at 0x20000000, ie the typical EBI memory address used for EBI CS1, is physically pinned behind the virtual 0xc8860000

One might presume 0xc8864000 maps to 0x20004000 (A14 decoding ?)


Top
 Profile  
 
 Post subject: Re: AT91SAM9G45-EKES based board with external 16c550 Uart
PostPosted: Fri May 27, 2011 8:10 pm 
Offline

Joined: Sun Apr 17, 2011 5:44 pm
Posts: 11
COMB is selected by NCS2 and mapped at MMIO 0x30000000:

Console: switching to colour frame buffer device 60x34
atmel_lcdfb atmel_lcdfb.0: fb0: Atmel LCDC at 0x00500000 (mapped at c885c000), irq 23
Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
ttyS0: autoconf (0x0000, 0xc8860000): iir=3 iir1=6 iir2=6 type=16550A
serial8250.0: ttyS0 at MMIO 0x20000000 (irq = 96) is a 16550A
ttyS1: autoconf (0x0000, 0xc8864000): iir=3 iir1=6 iir2=6 type=16550A
serial8250.0: ttyS1 at MMIO 0x30000000 (irq = 97) is a 16550A
atmel_usart.0: ttyAT0 at MMIO 0xfeffee00 (irq = 1) is a ATMEL_SERIAL
atmel_usart.1: ttyAT1 at MMIO 0xfff90000 (irq = 8) is a ATMEL_SERIAL
atmel_usart.2: ttyAT2 at MMIO 0xfff8c000 (irq = 7) is a ATMEL_SERIAL

its virtual address is 0xc8864000.

If are all correct why I don't have data in serial lines?


Top
 Profile  
 
 Post subject: Re: AT91SAM9G45-EKES based board with external 16c550 Uart
PostPosted: Fri May 27, 2011 9:07 pm 
Offline

Joined: Sat Oct 30, 2010 6:04 pm
Posts: 574
If your chip decodes are working properly, and you have proved you can probe the 16c550 in AT91BOOTSTRAP or UBOOT, then move to the kernel.

It should be relatively easy to code something that configures and output characters on such a UART. If you have two, then forward/crossover between the two of them. Orders on magnitude simpler to debug than within the kernel.

Confirm you understand the chip decoding, and that you understand how the 16C550 registers MAP into the address space you have created. As they are not 8-bit aligned, they are probably 32-bit aligned. Ask yourself where the registers are, and where in the 32-bit word they reside.

Once you have proved the viability of the hardware, then look at that knowledge, and how your device is is mapped/configured into the kernel.

For CS1 problems check your configuration of CCFG_EBICSA, make SURE you don't have code remnants from it being set up to DDR2/SDRAM within AT91BootStrap.


Top
 Profile  
 
 Post subject: Re: AT91SAM9G45-EKES based board with external 16c550 Uart
PostPosted: Wed Jun 08, 2011 2:55 pm 
Offline

Joined: Sun Apr 17, 2011 5:44 pm
Posts: 11
Solved!

The problem was incorrect programing for PC0 PC1 irq lines.

Thanks,
Paulo.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Search for:
Jump to: