[En-Nut-Discussion] TWI at AT91SAM9260 and Nut/OS Driver

af_80 a_funk80 at yahoo.de
Tue Jun 24 17:45:39 CEST 2008




Harald Kipp wrote:
> 
> May be I'm blind, but I can't see any call to TwInit().
> 

Why should I use TwInit()? I thought its specifies the Slave address. Can
you explain it please?
To test is i included this function with sla address 0x00 (and an other) but
the lines stays without some changes.


int main(void)
{
    u_long baud = 115200;
    unsigned int val = 0;
    unsigned int cnt = 0;

    
    NutRegisterDevice(&DEV_DEBUG, 0, 0);
    freopen(DEV_DEBUG_NAME, "w", stdout);
    _ioctl(_fileno(stdout), UART_SETSPEED, &baud);
	
    TwInit(0xA0);
    
   	twi_tx_buf[0] = 0xAA;
	twi_tx_buf[1] = 0x55;
	twi_tx_buf[2] = 0xBB;
	twi_tx_buf[3] = 0xCC;

    for(;;) 
    {
    	 cnt++;
    	 TWI_write_EEPROM(0xA0, 0, twi_tx_buf, 10);
    	 NutSleep(500);
    	 
    	 TWI_read_EEPROM(0xA0, 0, twi_rx_buf, 10);
    	 printf("\n%i TWI RX Data: \r\n", cnt);
    	 for(val = 0; val < 10; val++) 
    	 {
    		 printf("0X%x, ", twi_rx_buf[val]); 
    		 twi_rx_buf[val] = 0x00;
    	 }
    	 printf("\r\n");
    }
}
///////////////////////////////////////////////////////////////////////////////////////////
int TwInit  ( u_char  sla   )   

Initialize TWI interface. 

The specified slave address is not used here as we don't support twi-slave
on AT91SAM7X


Note:
This function is only available on AT91SAM7xxxx systems.
Parameters:
 sla  Slave address, must be specified as a 7-bit address, always lower than
128.  


-- 
View this message in context: http://www.nabble.com/TWI-at-AT91SAM9260-and-Nut-OS-Driver-tp18086632p18093874.html
Sent from the MicroControllers - Ethernut mailing list archive at Nabble.com.




More information about the En-Nut-Discussion mailing list