AVR Freaks Forum Index

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
DocuGeek
PostPosted: Feb 08, 2009 - 09:44 AM
Wannabe


Joined: Feb 03, 2008
Posts: 56


About a year ago I received a lot of wonderful help getting all the serial ports going on an NGW board. Here is that thread:
Code:
http://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=60005

I tried to set up a build to do this again, and found that the code has changed enough so that what I did last year can't be done the same way.

Using the latest (or very recent) buildroot-avr32-v2.1.0 completely from source, I modified the project_build_avr32/atngw100/linux-2.6.27.6/arch/avr32/boards/atngw100/setup.c file. (See the comments):
Code:
static int __init atngw100_init(void)
{
        unsigned        i;

        /*
         * ATNGW100 uses 16-bit SDRAM interface, so we don't need to
         * reserve any pins for it.
         */

        at32_add_device_usart(0);

        at32_add_device_usart(1); /* DocuGeek added USART1 device */
        at32_add_device_usart(2); /* DocuGeek added USART2 device */
        at32_add_device_usart(3); /* DocuGeek added USART3 device */


I was concerned because these three ports might conflict with other items:
Quote:
USART0 shares with PSIF Clock0/Data0
USART2 shares with EXTINT 1 and 2
USART3 shares with SSC2 Frame/Clock
but I could not find anything but the PSIF in the code.
Code:
/* DocuGeek removed this:
        at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info));
*/
I looked through the project_build_avr32/atngw100/linux-2.6.27.6/arch/avr32/mach-at32ap/at32ap700x.c file, and it appears that all the configurations have been moved elsewhere.

So, I was hoping that, since many things had been changed, that was all I needed to do. However, after
Code:
make rootclean
make
and extracting the rootfs.avr32.tar file from binaries/atngw100 to an SD Flash, and booting it, the dmesg gave me the same old single SERIAL line it had before.
Code:
...
io scheduler cfq registered (default)
atmel_usart.0: ttyS0 at MMIO 0xffe01000 (irq = 7) is a ATMEL_SERIAL
MACB_mii_bus: probed
...
To me, this is a clear sign that the serial ports have not been configured.

What am I missing?
 
 View user's profile Send private message  
Reply with quote Back to top
squidgit
PostPosted: Feb 16, 2009 - 10:58 AM
Raving lunatic


Joined: Sep 14, 2003
Posts: 4209
Location: Queanbeyan, Australia

If there are pin conflicts the boot logs will be full of backtraces and scary things like that.

You look like you`re simply missing the calls to at32_map_usart() in the board setup function. I`m not in the office this at the moment so can`t be of more specific help, but look through setup.c for lines which are commented with something like
Code:
USARTA -> ttyS1


-S.

_________________
Blag: http://www.niasdigital.com/blag
 
 View user's profile Send private message  
Reply with quote Back to top
hce
PostPosted: Feb 16, 2009 - 11:39 AM
Raving lunatic


Joined: Jan 07, 2003
Posts: 3753
Location: Trondheim, Norway

Remember to do a
Code:
make linux26-force
after changing the kernel code.
 
 View user's profile Send private message  
Reply with quote Back to top
romavr
PostPosted: Feb 17, 2009 - 06:09 AM
Rookie


Joined: Apr 02, 2007
Posts: 27


Find at32_map_usart call in your setup.c and
add the lines like this

Code:

at32_map_usart(1, 0); /*usart1 as ttyS0*/
at32_map_usart(0, 1); /*usart0 as ttyS1*/
at32_map_usart(2, 2); /*usart2 as ttyS2*/
at32_map_usart(3, 3); /*usart3 as ttyS3*/


And here is the chunk of my startup log
Code:

io scheduler noop registered
io scheduler cfq registered (default)
atmel_usart.0: ttyS0 at MMIO 0xffe01000 (irq = 7) is a ATMEL_SERIAL
atmel_usart.1: ttyS1 at MMIO 0xffe00c00 (irq = 6) is a ATMEL_SERIAL
atmel_usart.2: ttyS2 at MMIO 0xffe01400 (irq = 8) is a ATMEL_SERIAL
atmel_usart.3: ttyS3 at MMIO 0xffe01800 (irq = 9) is a ATMEL_SERIAL
MACB_mii_bus: probed
eth0: Atmel MACB at 0xfff01800 irq 25 (00:04:25:1c:8b:cc)
eth0: attached PHY driver [Generic PHY] (mii_bus:phy_addr=0:01, irq=-1)
MACB_mii_bus: probed   
 
 View user's profile Send private message  
Reply with quote Back to top
DocuGeek
PostPosted: Feb 19, 2009 - 08:07 AM
Wannabe


Joined: Feb 03, 2008
Posts: 56


Thanks for the continued help!

Just to document exactly what I changed:

Code:
void __init setup_board(void)
{
        at32_map_usart(1, 0);   /* USART 1: /dev/ttyS0, DB9 */
        at32_setup_serial_console(0);

        at32_map_usart(0, 1);   /* DocuGeek maps USART0 to /dev/ttyS1 */
        at32_map_usart(2, 2);   /* DocuGeek maps USART2 to /dev/ttyS2 */
        at32_map_usart(3, 3);   /* DocuGeek maps USART3 to /dev/ttyS3 */
}


Code:
static int __init atngw100_init(void)
{
        unsigned        i;

        /*
         * ATNGW100 uses 16-bit SDRAM interface, so we don't need to
         * reserve any pins for it.
         */

        at32_add_device_usart(0);

        at32_add_device_usart(1); /* DocuGeek added USART1 device */
        at32_add_device_usart(2); /* DocuGeek added USART2 device */
        at32_add_device_usart(3); /* DocuGeek added USART3 device */

        set_hw_addr(at32_add_device_eth(0, &eth_data[0]));
        set_hw_addr(at32_add_device_eth(1, &eth_data[1]));

/* DocuGeek removed this:
        at32_add_device_spi(0, spi0_board_info, ARRAY_SIZE(spi0_board_info));
*/
        at32_add_device_mci(0, &mci0_data);


Both of those are in this file:

/home/l1g8/AtmelNGW/buildroot-avr32-v2.3.0/project_build_avr32/atngw100/linux-2.6.27.6/arch/avr32/boards/atngw100/setup.c

I have my doubts about removing that at32_add_device_spi - the /dev/ list no longer has an mtdblock3, and so I cannot map the Serial Flash. I was trying to turn off the PSIF-Clock0 and -Data0 and became confused.

Anyhow, all the above was done that way from the beginning of this post - I had just forgotten to mention the setup_board(void) call in my previous post.

What actually helped was this:

Code:
make linux26-force


So, hce, from what part of the entire Earth did you come up with that?

GONE is my small feeling of competence at discovering the end of /home/l1g8/AtmelNGW/buildroot-avr32-v2.3.0/Makefile had a list of "make" commands and meanings.

I checked again, and linux26-force is nowhere in that file. Anyhow, thanks for the magical incantation!

And thanks to you all for getting me by this snag and on to the next step.
 
 View user's profile Send private message  
Reply with quote Back to top
hce
PostPosted: Feb 19, 2009 - 08:56 AM
Raving lunatic


Joined: Jan 07, 2003
Posts: 3753
Location: Trondheim, Norway

Take a peek in target/linux/Makefile.in or target/linux/Makefile.in.advanced, whatever you have enabled. Most likely the latter.
 
 View user's profile Send private message  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT + 1 Hour
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2006 The PNphpBB Group
Credits