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  [ 9 posts ] 
Author Message
 Post subject: How to enable ALL serial ports in SAM9G25 Evaluation Board
PostPosted: Tue Jan 24, 2012 10:22 am 
Offline

Joined: Mon Dec 19, 2011 7:01 pm
Posts: 25
I am using SAM9G25 (EMBEST) Evaluation board (SAM9X5EK).

My kernel version is 2.6.39 and build root is 2011-05

I need to enable and test(R/W) all the serial ports in the board (connectinng to the correponding pin in IO expander ports J1, J2 and J3).
I'm able to read/write ONLY to USART0 port (ttyS1) and cannot in S2-S6. :(

I tried below things to enable the serial ports:
I have disabled the ISI (video capture) and SPI interfaces in the kernel build. I added the following code in function "ek_map_io" of "board-sam9x5ek.c" (in arch/arm/mach-at91 path).

at91_register_uart(AT91SAM9X5_ID_USART1, 2, 0); /*ttyS2*/
at91_register_uart(AT91SAM9X5_ID_USART2, 3, 0); /*ttyS3*/
at91_register_uart(AT91SAM9X5_ID_USART3, 4, 0); /*ttyS4*/
at91_register_uart(AT91SAM9X5_ID_UART0, 5, 0); /*ttyS5*/
at91_register_uart(AT91SAM9X5_ID_UART1, 6, 0); /*ttyS6*/


Also, kernel boot-up message shows the correct registration on the serial ports.
I created corresponding /dev/ttyS devices in /dev directory of RFS.

# ls -l /dev/ttyS*
crw------- 1 root root 4, 64 Jan 23 2012 /dev/ttyS0
crw-rw---- 1 root root 4, 65 Jan 23 2012 /dev/ttyS1
crw-rw---- 1 root root 4, 66 Jan 23 2012 /dev/ttyS2
crw-rw---- 1 root root 4, 67 Jan 23 2012 /dev/ttyS3
crw-rw---- 1 root root 4, 68 Jan 23 2012 /dev/ttyS4
crw-rw---- 1 root root 4, 69 Jan 23 2012 /dev/ttyS5
crw-rw---- 1 root root 4, 70 Jan 23 2012 /dev/ttyS6


I tried to write to S2-S6 tty serial ports. The "open" call returns a valid file descriptor and "write" returns success with specified number of written bytes.

Now, the bytes do not appear on the corresponding pins on IO expanders (J1, J2 and J3).

Please help me in enabling ALL the serial ports in SAM9G25 evaluation board.

please find the kernel bootup log below:



Starting kernel ...

Uncompressing Linux... done, booting the kernel.
Linux version 2.6.39 (root@ubuntu) (gcc version 4.3.5 (Buildroot 2011.05) ) #8 M
on Jan 23 17:38:45 IST 2012
CPU: ARM926EJ-S [41069265] revision 5 (ARMv5TEJ), cr=00053177
CPU: VIVT data cache, VIVT instruction cache
Machine: Atmel AT91SAM9X5-EK
Memory policy: ECC disabled, Data cache writeback
Clocks: CPU 400 MHz, master 133 MHz, main 12.000 MHz
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 32512
Kernel command line: root=/dev/nfs rw nfsroot=192.168.1.147:/rootfs/rfs_samg25 i
p=192.168.1.174:192.168.1.147:192.168.1.1:255.255.255.0::: console=ttyS0,115200
mtdparts=atmel_nand:8M(bootstrap/uboot/kernel)ro,-(rootfs) mem=128M
PID hash table entries: 512 (order: -1, 2048 bytes)
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 125312k/125312k available, 5760k reserved, 0K highmem
Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
DMA : 0xff000000 - 0xffe00000 ( 14 MB)
vmalloc : 0xc8800000 - 0xfee00000 ( 870 MB)
lowmem : 0xc0000000 - 0xc8000000 ( 128 MB)
modules : 0xbf000000 - 0xc0000000 ( 16 MB)
.init : 0xc0008000 - 0xc002d000 ( 148 kB)
.text : 0xc002d000 - 0xc043f97c (4171 kB)
.data : 0xc0440000 - 0xc0468520 ( 162 kB)
NR_IRQS:192
AT91: 128 gpio irqs in 4 banks
Console: colour dummy device 80x30
console [ttyS0] enabled
Calibrating delay loop... 199.06 BogoMIPS (lpj=995328)
pid_max: default: 32768 minimum: 301
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
AT91: CM rev B and higher
AT91: EK rev B and higher
AT91: Power Management (with slow clock mode)
AT91: Starting after general reset
bio: create slab <bio-0> at 0
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
i2c-gpio i2c-gpio.0: using pins 62 (SDA) and 63 (SCL)
at_hdmac at_hdmac.0: Atmel AHB DMA Controller ( cpy slave ), 8 channels
at_hdmac at_hdmac.1: Atmel AHB DMA Controller ( cpy slave ), 8 channels
Advanced Linux Sound Architecture Driver Version 1.0.24.
cfg80211: Calling CRDA to update world regulatory domain
Switching to clocksource tcb_clksrc
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
UDP hash table entries: 256 (order: 0, 4096 bytes)
UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
NET: Registered protocol family 1
RPC: Registered udp transport module.
RPC: Registered tcp transport module.
RPC: Registered tcp NFSv4.1 backchannel transport module.
NetWinder Floating Point Emulator V0.97 (double precision)
JFFS2 version 2.2. (NAND) (SUMMARY) © 2001-2006 Red Hat, Inc.
msgmni has been set to 244
io scheduler noop registered (default)
[color=#BF0040]atmel_usart.0: ttyS0 at MMIO 0xfefff200 (irq = 1) is a ATMEL_SERIAL
atmel_usart.1: ttyS1 at MMIO 0xf801c000 (irq = 5) is a ATMEL_SERIAL
atmel_usart.2: ttyS2 at MMIO 0xf8020000 (irq = 6) is a ATMEL_SERIAL
atmel_usart.3: ttyS3 at MMIO 0xf8024000 (irq = 7) is a ATMEL_SERIAL
atmel_usart.4: ttyS4 at MMIO 0xf8028000 (irq = 8) is a ATMEL_SERIAL
atmel_usart.5: ttyS5 at MMIO 0xf8040000 (irq = 15) is a ATMEL_SERIAL
atmel_usart.6: ttyS6 at MMIO 0xf8044000 (irq = 16) is a ATMEL_SERIAL
brd: module loaded
loop: module loaded
ssc ssc.0: Atmel SSC device at 0xc8898000 (irq 28)
atmel_nand atmel_nand: Using dma0chan0 for DMA transfers.
ONFI flash detected
ONFI param page 0 valid
NAND device: Manufacturer ID: 0x2c, Chip ID: 0xda (Micron MT29F2G08AAD)
atmel_pmecc_init_params
Scanning device for bad blocks
2 cmdlinepart partitions found on MTD device atmel_nand
Creating 2 MTD partitions on "atmel_nand":
0x000000000000-0x000000800000 : "bootstrap/uboot/kernel"
0x000000800000-0x000010000000 : "rootfs"
macb macb.0: eth0: Features changed: 0x00004800 -> 0x00004000
MACB_mii_bus: probed
eth0: Atmel MACB at 0xf802c000 irq 24 (82:8a:d6:84:e7:3a)
eth0: attached PHY driver [Davicom DM9161A] (mii_bus:phy_addr=0:00, irq=-1)
ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
atmel-ehci atmel-ehci: Atmel EHCI UHP HS
atmel-ehci atmel-ehci: new USB bus registered, assigned bus number 1
atmel-ehci atmel-ehci: irq 22, io mem 0x00700000
atmel-ehci atmel-ehci: USB 2.0 started, EHCI 1.00
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 3 ports detected
ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
at91_ohci at91_ohci: AT91 OHCI
at91_ohci at91_ohci: new USB bus registered, assigned bus number 2
at91_ohci at91_ohci: irq 22, io mem 0x00600000
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 3 ports detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
usbcore: registered new interface driver libusual
atmel_usba_udc atmel_usba_udc: MMIO registers at 0xf803c000 mapped at c88a2000
atmel_usba_udc atmel_usba_udc: FIFO at 0x00500000 mapped at c8900000
qt1070 0-001b: can not read register, returned -6
qt1070 0-001b: ID -6 not supported
at91_rtc at91_rtc: rtc core: registered at91_rtc as rtc0
AT91 Real Time Clock driver.
i2c /dev entries driver
usbcore: registered new interface driver usbhid
usbhid: USB HID core driver
asoc: wm8731-hifi <-> atmel-ssc-dai.0 mapping ok
ASoC: at91sam9x5ek_init ok
ALSA device list:
#0: AT91SAM9X5
nf_conntrack version 0.5.0 (1958 buckets, 7832 max)
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP cubic registered
NET: Registered protocol family 17
lib80211: common routines for IEEE802.11 drivers
Registering the dns_resolver key type
at91_rtc at91_rtc: setting system clock to 2007-01-01 00:00:12 UTC (1167609612)
atmel_mci atmel_mci.0: Using dma0chan1 for DMA transfers
atmel_mci atmel_mci.0: Atmel MCI controller at 0xf0008000 irq 12, 1 slots
atmel_mci atmel_mci.1: Using dma1chan0 for DMA transfers
atmel_mci atmel_mci.1: Atmel MCI controller at 0xf000c000 irq 26, 1 slots
IP-Config: Complete:
device=eth0, addr=192.168.1.174, mask=255.255.255.0, gw=192.168.1.1,
host=192.168.1.174, domain=, nis-domain=(none),
bootserver=192.168.1.147, rootserver=192.168.1.147, rootpath=
eth0: link up (100/Full)
VFS: Mounted root (nfs filesystem) on device 0:13.
Freeing init memory: 148K
starting pid 449, tty '': '/etc/init.d/rcS'
mknod: /dev/null: File exists
Populating /dev using udev: udevd (453): /proc/453/oom_adj is deprecated, please
use /proc/453/oom_score_adj instead.
done
Starting portmap: done
Initializing random number generator... done.
ALSA: Restoring mixer settings...
Starting network...
RTNETLINK answers: File exists
Starting dropbear sshd: OK
starting pid 480, tty '/dev/ttyS0': '/sbin/getty -L ttyS0 115200 vt100 '

Welcome to Buildroot
AT91SAM9 login: root
#[/color]


Top
 Profile  
 
 Post subject: Re: How to enable ALL serial ports in SAM9G25 Evaluation Boa
PostPosted: Tue Jan 24, 2012 11:05 am 
Offline

Joined: Thu Apr 19, 2007 10:15 pm
Posts: 330
Location: USA
> I need to enable and test(R/W) all the serial ports in the board (connectinng to the correponding pin in IO expander ports J1, J2 and J3).

Check the schematic for your board for RS-232 level converter chips on those serial port lines. The "serial port" pins on J1, J2, and J3 might only have logic levels rather than RS-232 levels. You can also confirm that with a voltmeter. The transmit pins would mark at 3 volts for logic level or -3 to -15 volts for RS-232 level.

Regards


Top
 Profile  
 
 Post subject: Re: How to enable ALL serial ports in SAM9G25 Evaluation Boa
PostPosted: Tue Jan 24, 2012 11:53 am 
Offline

Joined: Mon Dec 19, 2011 7:01 pm
Posts: 25
>"Check the schematic for your board for RS-232 level converter chips on those serial port lines. The "serial port" pins on J1, J2, and J3 might only have logic levels rather than RS-232 levels. You can also confirm that with a voltmeter. The transmit pins would mark at 3 volts for logic level or -3 to -15 volts for RS-232 level."

Hi,

I'm using TTL to USB serial converter to connect the ports to my PC. So anything appears on the IO pins, it should be captured by serial terminal in my PC.

Thanks,


Top
 Profile  
 
 Post subject: Re: How to enable ALL serial ports in SAM9G25 Evaluation Boa
PostPosted: Tue Jan 24, 2012 8:13 pm 
Offline

Joined: Tue Dec 06, 2011 5:24 pm
Posts: 6
Hi,
1) check, if there is some signal on the TX pin while sending some data (#echo A > /dev/ttySx)
2) check if the boudrate matches the one in your USB converter
3) if still not working, try moving "registration of ttyS's" in your board-specific file to the end (after registering everithing else), and check the implementation of such registration (if the pins specified agree with your hardware)


Top
 Profile  
 
 Post subject: Re: How to enable ALL serial ports in SAM9G25 Evaluation Boa
PostPosted: Thu Feb 09, 2012 1:53 pm 
Offline

Joined: Mon Dec 19, 2011 7:01 pm
Posts: 25
Hi,
I was able to enable and READ/WRITE to all the serial ports in the SAM9G25 Evaluation board.
I had to DISABLE the ISI and SPI interface to free the PIO pins.
Also, I had to register the serial ports using "at91_register_uart" call in the source file "arch/arm/mach-at91/board-sam9x5ek.c".

But one other BIGGG issue was that, DMA for Rx/Tx were enabled in defaullt in the serial port configurations; "atmel_uart_data usartX_data" and "atmel_uart_data uartX_data" structures in at91sam9x5ek_devices.c. (X = 0, 1.. etc).

I had to disable them (.use_dma_tx = 0 and .use_dma_rx = 0) in the configuration structures to get the serial ports working.

Could anybody help me in rectifying the DMA enabled serial port transfers for usart 0-3 and uart 0-1 for SAM9G25 ?


Top
 Profile  
 
 Post subject: Re: How to enable ALL serial ports in SAM9G25 Evaluation Boa
PostPosted: Fri May 04, 2012 9:12 pm 
Offline

Joined: Fri Oct 28, 2011 7:25 pm
Posts: 57
I know this is an old thread, but in case you never figured it out I ran into the same problem. From looking at arch/arm/mach-at91/board-sam9x5ek.c, it appears the problem is that the USARTs and UARTs are set to use DMA, but then a proper DMA channel is never setup for the UARTs. The only one that is properly setup for DMA is USART0 TX. I've attached a patch file that fixed the issue for me. I'd previously made other modifications to this file to register devices I care about, so the line numbering may be off for you.

EDIT: I had issues with the file attachments. NOW my patch is attached.


Attachments:
usart_fixes.patch.tar.gz [750 Bytes]
Downloaded 156 times
Top
 Profile  
 
 Post subject: Re: How to enable ALL serial ports in SAM9G25 Evaluation Boa
PostPosted: Tue May 15, 2012 10:45 pm 
Offline

Joined: Tue May 15, 2012 10:35 pm
Posts: 4
Thanks for attaching the patch -- it fixed my serial dma issues as well.


Top
 Profile  
 
 Post subject: Re: How to enable ALL serial ports in SAM9G25 Evaluation Boa
PostPosted: Tue May 22, 2012 11:52 am 
Offline

Joined: Mon Mar 19, 2007 7:46 am
Posts: 2
Hi,

I have also same problem. But, I tried with the patch it doesn't work. Can you help me.

Thanks

Siddhiq


Top
 Profile  
 
 Post subject: Re: How to enable ALL serial ports in SAM9G25 Evaluation Boa
PostPosted: Wed Aug 22, 2012 5:38 am 
Offline

Joined: Wed Aug 22, 2012 5:33 am
Posts: 1
I have also same problem. :?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 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: