[En-Nut-Discussion] changing of OS v4.2.1 to v4.3.3 bit wiht respect to ToWireBitBanningInterFase

Lokker, Ronald R.Lokker at krohne-altometer.nl
Tue Aug 7 14:21:29 CEST 2007


Super Developers,

Question

i use a at91sam7x-ek board and i inplemented a RTC circuit as the
eternut3 board and i enabele in the config X12RTC
		(nut os configuration - Device drivers - x12xx driver -
system configuration - ENABELED) 

but the cpu's are different ant the i/o ports are not the same
	ethernut    board CPU AT91R40008	clock at Poort P17
data at Poort P16	(cpu has 1 poort)
	and i use e free poort to te SAM cpu as follows
	atmelsam board CPU AT91SAM7X	clock at Poort PA29	data at
Poort PA26	(cpu has 2 poorts PA and PB)

so i eddit the file (first i copy the file twbbif.c to twbbifsam.c) and
edit the file twbbifsam.c an change

this

	#if defined(__arm__)
	
	#include <arch/arm.h>

	#ifndef TWI_SDA_BIT
	#define TWI_SDA_BIT     16
	#endif
	#ifndef TWI_SDA_PE_REG
	#define TWI_SDA_PE_REG  PIO_PER
	#endif
	#ifndef TWI_SDA_OE_REG
	#define TWI_SDA_OE_REG  PIO_OER
	#endif
	#ifndef TWI_SDA_OD_REG
	#define TWI_SDA_OD_REG  PIO_ODR
	#endif
	#ifndef TWI_SDA_COD_REG
	#define TWI_SDA_COD_REG PIO_CODR
	#endif
	#ifndef TWI_SDA_SOD_REG
	#define TWI_SDA_SOD_REG PIO_SODR
	#endif
	#ifndef TWI_SDA_PDS_REG
	#define TWI_SDA_PDS_REG PIO_PDSR
	#endif	

	#ifndef TWI_SCL_BIT
	#define TWI_SCL_BIT     17
	#endif
	#ifndef TWI_SCL_PE_REG
	#define TWI_SCL_PE_REG  PIO_PER
	#endif
	#ifndef TWI_SCL_OE_REG
	#define TWI_SCL_OE_REG  PIO_OER
	#endif
	#ifndef TWI_SCL_OD_REG
	#define TWI_SCL_OD_REG  PIO_ODR
	#endif
	#ifndef TWI_SCL_COD_REG
	#define TWI_SCL_COD_REG PIO_CODR
	#endif
	#ifndef TWI_SCL_SOD_REG
	#define TWI_SCL_SOD_REG PIO_SODR
	#endif

in that

	#if defined(__arm__)
	
	#include <arch/arm.h>
	
	#ifndef TWI_SDA_BIT
	#define TWI_SDA_BIT     26
	#endif
	#ifndef TWI_SDA_PE_REG
	#define TWI_SDA_PE_REG  PIOA_PER
	#endif
	#ifndef TWI_SDA_OE_REG
	#define TWI_SDA_OE_REG  PIOA_OER
	#endif
	#ifndef TWI_SDA_OD_REG
	#define TWI_SDA_OD_REG  PIOA_ODR	
	#endif
	#ifndef TWI_SDA_COD_REG
	#define TWI_SDA_COD_REG PIOA_CODR
	#endif
	#ifndef TWI_SDA_SOD_REG
	#define TWI_SDA_SOD_REG PIOA_SODR
	#endif
	#ifndef TWI_SDA_PDS_REG
	#define TWI_SDA_PDS_REG PIOA_PDSR
	#endif
	
	#ifndef TWI_SCL_BIT
	#define TWI_SCL_BIT     29
	#endif
	#ifndef TWI_SCL_PE_REG
	#define TWI_SCL_PE_REG  PIOA_PER
	#endif
	#ifndef TWI_SCL_OE_REG	
	#define TWI_SCL_OE_REG  PIOA_OER
	#endif
	#ifndef TWI_SCL_OD_REG
	#define TWI_SCL_OD_REG  PIOA_ODR
	#endif
	#ifndef TWI_SCL_COD_REG
	#define TWI_SCL_COD_REG PIOA_CODR
	#endif
	#ifndef TWI_SCL_SOD_REG
	#define TWI_SCL_SOD_REG PIOA_SODR
	#endif

and than last but no least

edit the file ((so this choosen the file by config) HW_MCU_AT91R40008
use twbbif.c and HW_MCU_AT91SAM7X use twbbifsam.c)

\ethernut-4.2.1\nut\conf\dev\dev.nut

from this 

    --
    -- Simple Interface Drivers.
    --
    {
        name = "nutdev_twbbif",
        brief = "Bit Banging Two Wire",
        description = "Tested on AT91 only.",
        requires = { "HW_MCU_AT91R40008" },
        provides = { "DEV_TWI" },
        sources = { "twbbif.c" }
    },

to that

    --
    -- Simple Interface Drivers.
    --
    {
        name = "nutdev_twbbif",
        brief = "Bit Banging Two Wire",
        description = "Tested on AT91 only.",
        requires = { "HW_MCU_AT91R40008" },
        provides = { "DEV_TWI" },
        sources = { "twbbif.c" }
    },
    {
        name = "nutdev_twbbif",
        brief = "Bit Banging Two Wire SAM",
        description = "Tested on SAM only.",
        requires = { "HW_MCU_AT91SAM7X" },
        provides = { "DEV_TWI" },
        sources = { "twbbifsam.c" }
    },

and than it is working 

but i wil now change from os v4.2.1 to v4.3.3

and i have heard that the bit ToWireBitBanningInterFase ar now
configurabel 

and the question are how to do ???

ps let this also a good lesson to change the os device of your choic

Ronald  :-)

====================================== DISCLAIMER =================================== 
NOTE: The information transmitted in this email is for the person or entity to which it is addressed: 
it may contain information that is confidential and/or legally privileged. 
If you are not the intended recipient, please do not read, use, retransmit or disseminate this information. 
Although this email and any attachments are believed to be free of any virus, it is the responsibility 
of the recipient to ensure that they are virus free. No responsibility is accepted by the KROHNE Company 
for any loss or damage arising from receipt of this message. 
Furthermore, unless explicitly stated, this email is in no way a legally binding agreement. 
The views represented in this email do not necessarily represent those of the corporation. 


More information about the En-Nut-Discussion mailing list