Other Parts Discussed in Thread: HALCOGEN
Hi,
i ported the N2HET I2C emulation to RM42 and it is already working. I can see SCL/SDA being correct with my oszilloscope.
But i didnt connect any slave and so i expect to get an no-ack interrupt. But i didnt get any interrupt at all.
Does somebody had made the same experiences?
ISR from N2HET IC2 sample code:
#pragma CODE_STATE(het1HighLevelInterrupt, 32)
#pragma INTERRUPT(het1HighLevelInterrupt, IRQ)
void het1HighLevelInterrupt(void)
{
uint32_t vect = hetREG1->OFF1;
switch (vect)
{
case 11: /*---------------------------> Transmit interrupt */
if(Data_Send_HET<3)
{
HetI2CPutData(*I2C1_txptr++, IntEna);
Data_Send_HET++;
}
if(Start_Repeat==1)
{
if(Data_Send_HET<5)
{
HetI2CPutData(*I2C1_txptr++, IntEna);
Data_Send_HET++;
}
else if(Data_Send_HET==5)
{
RW = 1; //Read
IntEna = 0;//no transmit interrupt
HetI2CPutAddr(I2C2_ADDR, RW, 2, IntEna, 1);//now, start to receive two data bytes and generate stop bit
}
}
break;
case 15: /*---------------------------> Receive interrupt */
*I2C1_rxptr++ = (hetRAM1->Instruction[0x2C].Data>>8) & 0xFF; // read the data
Data_Rece_HET++;
break;
case 18: /*---------------------------> No ACK interrupt */
case 29: /* timeout2*/
case 8: /* timeout6*/
case 2: /* timeout9*/
default:
/* timeout + phantom interrupt, clear flags and return */
while(1);
break;
}
//*I2C2_rxptr++ = i2cREG1->DRR; // read the data
// Data_Rece++;
// break;
// case 5: /*---------------------------> Transmit interrupt */
// i2cREG1->DXR = *I2C2_txptr++; // send the data
// Data_Send++;
//hetNotification(hetREG1,vec);
}
/* USER CODE BEGIN (6) */
/* USER CODE END */
Best regards,
Malte