[En-Nut-Discussion] RFC: New driver interface for TWI, I2C and others

Uwe Bonnes bon at elektron.ikp.physik.tu-darmstadt.de
Wed Apr 27 11:41:22 CEST 2011

>>>>> "Ulrich" == Ulrich Prinz <uprinz2 at netscape.net> writes:

    Ulrich> Hi all!  I'd like to have your comments for the following thing:

    Ulrich> Why not initializing any driver for a multiply appearing
    Ulrich> hardware with a driver descriptor struct?

    Ulrich> We already have that for USART, I added it for SPI in ARM and
    Ulrich> will have that available for Cortex for all serial interfaces.

    Ulrich> I already added it for AT24C EEPROMs (if you encountered the
    Ulrich> difference to the old eeprom driver).

    Ulrich> So with any interface you register you provide a descriptive bus
    Ulrich> struct.

    Ulrich> The bus struct is of same basic structure as it already exists
    Ulrich> for the USARTs but modified to the needs of the bus it is for.

    Ulrich> In AVR and ARM USARTs are made of two files. usart1.c defines
    Ulrich> the init routines and all defines that name everything for the
    Ulrich> functions. These defines can be modified by nutconf.  Then it
    Ulrich> _includes_ the usart.c and compiles all the code dependent on
    Ulrich> the defines. For USART2 there is a usart2.c that again
    Ulrich> _includes_ usart.c again.

    Ulrich> If your chip provides 5 USARTs, it gets quite expensive in count
    Ulrich> of FLASH used.

    Ulrich> The solution I'd like to discuss is to make multiple
    Ulrich> c-includes-c obsolete.

    Ulrich> Let the discussion start!

Ethernut runs on RAM starving and platforms with ample RAM. My CAN
application on an AT90CAN128 uses one binary for a pletora of devices, as
flash with 120(128)kiB is ample, but RAM with 4 kiB is few. I guess those
driver descriptor structure will use ample RAM, and on those ram-starving
devices their usage has to be considered.

Otherwise the approach sound fine.

P.S.I am trying to switch to STM32F for the reason og low RAM on the
AT90CAN, the missing speed at 3.3 Volt and the missing 5-Volt tolerance of
the AVR when run at 3.3V.

PPS: Has anybody informations where to get STM32F2xx devices?
Uwe Bonnes                bon at elektron.ikp.physik.tu-darmstadt.de

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------

More information about the En-Nut-Discussion mailing list