Hello,
I use PMBus Demo in order to form a larger program. The larger program has a ePWM interrupt and do main process in it. When ePWM interrupt not come, PMBus works, and ePWM interrupt comes, it stoppes.
The Demo itself runs rightly. But in my program when I send Read/Write commands, such as ON_OFF_CONFIG, it returns NACK.
I checked the program and registers and found the problem. when the program runs to 'if (I2caRegs.I2CSTR.bit.SDIR == 0)', neither read commands nor write commands, the SDIR is 0. After a little time SDIR changes to right value. The part of the program is shown below.
case RWBYTE: //read/write byte
while(!I2caRegs.I2CSTR.bit.AAS); //wait until addressed by master
if (I2caRegs.I2CSTR.bit.SDIR == 0) //determine if slave should send/receive
{ //slave receiver
while(!I2caRegs.I2CSTR.bit.RRDY); //wait for the data
PMBusSlave_ReceiveBuffer[0] = I2caRegs.I2CDRR; //get the received data
StopCpuTimer0(); //No timeout, so stop the timer
ReloadCpuTimer0(); //Reload the period value (35 ms timeout)
}
else
{ //slave transmitter
while(!I2caRegs.I2CSTR.bit.XRDY); //make sure I2CDXR is clear
I2caRegs.I2CDXR = PMBusSlave_TransmitBuffer[0]; //send the data
StopCpuTimer0(); //No timeout, so stop the timer
ReloadCpuTimer0(); //Reload the period value (35 ms timeout)
}
break;
Is The SDIR problem caused by the ePWM interrupt? And is there any solutions?
Thanks,