ChibiOS on ATMEGA32L

ChibiOS public support forum for topics related to the Atmel AVR family of micro-controllers.

Moderator: tfAteba

matis
Posts: 53
Joined: Fri Jul 01, 2011 1:46 pm

ChibiOS on ATMEGA32L

Post by matis »

Hi Guys,

due to my enjoyable experience with ChibiOS on the F103, I want to try to make ChibiOS run on the ATMEGA32L I have on my RP6 Robot System.
I found out that there are a little demo's available for Atmel uC in ChibiOS, but that's on the ATMEGA128.
Do you guys think that it will ever gonna work?

I'll first start with setting up the environment (Ubuntu 10.04.3 32 bits) and see if I can get that to work :)

Matis

What I've done so far:
Installed avr-libc = AVR compiler and libraries
Installed openocd = Probably needed for flashing binary
Connected the RP6 USB Interface

Code: Select all

cat /proc/tty/driver/usbserial
usbserinfo:1.0 driver:2.0
0: module:ftdi_sio name:"FTDI USB Serial Device" vendor:0403 product:6001 num_ports:1 port:1 path:usb-0000:00:06.0-2

Installed avarice = Front and back-end debugger for AVR
Installed avrdude = AVR flasher suggested by Arexx
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS on ATMEGA32L

Post by Giovanni »

It depends on how much RAM it has, I wouldn't recommend it on less than 2 KB if you use many threads, of course you can use a one or two threads and the HAL with even less than that.

The test suite, requires 2KB on AVR and it uses 7 threads and a lot of RAM for strings.

Giovanni
matis
Posts: 53
Joined: Fri Jul 01, 2011 1:46 pm

Re: ChibiOS on ATMEGA32L

Post by matis »

The ATMEGA32L has a whopping
– 32Kbytes of In-System Self-programmable Flash program memory
– 1024Bytes EEPROM
– 2Kbytes Internal SRAM

So that seems be sufficient like you stated. I think that I want a maximum of two threads next to the main loop. One for polling all the sensors and one (blocking) for receiving data through the USB / UART interface for instructions.

I'm not familiar with the AVR Makefiles and tools, due to my (only) experience with the STM M3-series. But I guess that would be the less difficult part ;)

I'll first try to make ChibiOS compile for my MCU.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS on ATMEGA32L

Post by Giovanni »

It should be OK, in 2K you can do a lot of things.

Giovanni
matis
Posts: 53
Joined: Fri Jul 01, 2011 1:46 pm

Re: ChibiOS on ATMEGA32L

Post by matis »

I almost got it compiled :)
The RP6 is delivered with a "RP6 Library" (download) containing USART, I2C, SPI and timer functions and ISRs.

When I try to compile the RP6 library within ChibiOS, it gives me the following errors:

Code: Select all

/home/mathijs/sandbox/AVR-ATmega32L-GCC/chibios/boards/AREXX_RP6_ROBOT_SYSTEM/RP6Lib/RP6base/RP6RobotBaseLib.c:1463: multiple definition of `__vector_10'
/home/mathijs/sandbox/AVR-ATmega32L-GCC/chibios/boards/AREXX_RP6_ROBOT_SYSTEM/RP6Lib/RP6common/RP6uart.c:220: multiple definition of `__vector_13'

Pointing at TIMER0_COMP_vect and USART_RXC_vect respectively.

What is wise to do, drop the RP6Lib and use the ChibiOS implementation or otherwise?
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS on ATMEGA32L

Post by Giovanni »

Hi,

You can't use two HALs together, there would be conflicts for IRQs and probably other things too. I admit that the current AVR support in ChibiOS is not very complete, only Serial and PAL drivers are available.

Giovanni
matis
Posts: 53
Joined: Fri Jul 01, 2011 1:46 pm

Re: ChibiOS on ATMEGA32L

Post by matis »

Understood. The RP6Lib provides I2C master and slave functionality. Would you like me to add these to the AVR HAL?

I must admit that there are slight differences between the naming of ATMEGA128 and the ATMEGA32L.

But I'll try to make it as generic as possible :)
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS on ATMEGA32L

Post by Giovanni »

Heh, you don't have to ask me if you can do things, of course you can :-) I can only decide if code is generic and good enough for stable inclusion.

The general rule is that if I can't test it properly then I can't include it.

Because of this there is a lot of contributed code sleeping on the repository, see the FX16/LX16, H8S, Coldfire and AVR32 ports. I can't include them if I am not able to do maintenance (and in general if there is not enough interest around the platform).

Anyway, I know there is already an ongoing effort to create more drivers for AVR but I don't know the current status.

Giovanni
matis
Posts: 53
Joined: Fri Jul 01, 2011 1:46 pm

Re: ChibiOS on ATMEGA32L

Post by matis »

I'm interested in the (pending) development done in the AVR32 port. A quick peek in the https://chibios.svn.sourceforge.net/svn ... /branches/ doesn't show me a branch containing that development. Can or will you create a avr32_dev branch and submit all the pending development or the "work in progress"?

I'm willing to actively support the AVR32 (especially ATMEGA32 related) HAL development.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: ChibiOS on ATMEGA32L

Post by Giovanni »

Hi,

Michael Fischer is the author of the AVR32 port (he ported ChibiOS to several architectures), he maintains a ChibiOS page here: http://www.yagarto.de/projects/chibios/index.html

Giovanni
Post Reply