Hello everybody,
I have a problem using the I2C-periphal on the RM48L952. I used HALCoGen to configure everything (I2C, HET, SPI, SCI, GIO etc.) and when I debug my board it works like expected.
When I unplug my debug-probe everything (HET, SPI, SCI, GIO etc.) expect I2C is still working.
this is the (minimal) code I'm using:
... void main(void) { /* USER CODE BEGIN (3) */
int button=0;
gioInit(); hetInit(); sciInit(); spiInit(); i2cInit(); _enable_IRQ(); while(1) { ... if(gioGetBit(hetPORT1,11)) //Button pressed? { i2cSetSlaveAdd(i2cREG1, 0x48); i2cSetDirection(i2cREG1, I2C_RECEIVER); i2cSetCount(i2cREG1, 1); i2cSetMode(i2cREG1, I2C_MASTER); i2cSetStop(i2cREG1); /* Transmit Start Condition */ i2cSetStart(i2cREG1); button=i2cReceiveByte(i2cREG1); /* Wait until Bus Busy is cleared */ while(i2cIsBusBusy(i2cREG1) == true); /* Wait until Stop is detected */ while(i2cIsStopDetected(i2cREG1) == 0); /* Clear the Stop condition */ i2cClearSCD(i2cREG1); } ... } }
When I debug my project, I can (as expected) monitor the communication with a logic analyzer. In "non-debug-mode" there is nothing happening at the i2c pins at all.
What am I doing wrong?
best regards,
Andreas