SAM3x8e TWI start stop condition code in Atmel studio 7

Discussion around product based on ARM Cortex M3 core.
This forum will be discontinued soon.

Moderators: nferre, ncollot

usrrsr
Posts: 2
Joined: Wed Aug 23, 2017 9:59 am

SAM3x8e TWI start stop condition code in Atmel studio 7

Wed Aug 23, 2017 10:10 am

Hello everyone,

I am using Ardunio Due board (atmel SAM3x8e microcontroller) in Atmel Studio 7.

I am getting start and stop condition by code, i tried all options but still both SDA and SCL pins remains high

My code is
calling function as i2c_start(Twi1); etc

void i2c_start(Twi *p_twi)
{
//Twi *p_twi;
//p_twi=TWI1;
//p_twi->TWI_CR &= 0xFFFFFFF1;
//TWI1->TWI_CR = TWI_CR_START | TWI_CR_STOP;
//TWI1->TWI_CR = TWI_CR_START;
//p_twi->TWI_CR = TWI_CR_START;
p_twi->TWI_CR = TWI_CR_START;


}

void i2c_stop(Twi *p_twi)
{
//Twi *p_twi;
//p_twi=TWI1;
//p_twi->TWI_CR &= 0xFFFFFFF2;
//TWI1.TWI_CR = TWI_CR_START | TWI_CR_STOP;
//TWI1->TWI_CR &= 0xFFFFFFF2;
p_twi->TWI_CR = TWI_CR_STOP;

}

Please let me know if anybody knows how to get it by code.

Regards,

Return to “SAM3 Cortex-M3 MCU”

Who is online

Users browsing this forum: Bing [Bot] and 1 guest