Using MK22FX512VLK12 chip programming with P&E micro Multilink universal Programmer
I am Trying to get the I2C bus working.
nothing is sent across the data or clock lines. I looked on my Oscilloscope and nothing happens.
I am using the code from "typical usage section under "Help on Component"
Component documentation - Typical Usage
volatile bool DataReceivedFlg = FALSE; volatile bool DataTransmittedFlg = FALSE; uint8_t OutData[4] = {0x00U, 0x01U, 0x02U, 0x03U}; /* Initialization of output data buffer */ uint8_t InpData[16]; LDD_TError Error; LDD_TDeviceData *MyI2CPtr; void main(void) { . . . MyI2CPtr = I2C2_Init(NULL); /* Initialization of I2C2 component */ /* Configure I2C BUS device(e.g. RTC) - Write Operation */ Error = I2C2_MasterSendBlock(MyI2CPtr, OutData, 4U, LDD_I2C_SEND_STOP); /* Send OutData (4 bytes) on the I2C bus and generates a stop condition to end transmission */ while (!DataTransmittedFlg) { /* Wait until OutData are transmitted */ } DataTransmittedFlg = FALSE; /* Read configuration of I2C BUS device(e.g. RTC) - Read Operation */ OutData[0] = 0x00U; /* Initialization of OutData buffer */ Error = I2C2_MasterSendBlock(MyI2CPtr, OutData, 1U, LDD_I2C_NO_SEND_STOP); /* Send OutData (1 byte) on the I2C bus stop condition and will not generate the end of the transmission */ while (!DataTransmittedFlg) { /* Wait until OutData are transmitted */ } DataTransmittedFlg = FALSE; Error = I2C2_MasterReceiveBlock(MyI2CPtr, InpData, 16U, LDD_I2C_SEND_STOP); /* Receive InpData (16 bytes) from the I2C bus and generates a stop condition to end transmission */ while (!DataReceivedFlg) { /* Wait until InpData are received */ } DataReceivedFlg = FALSE; for(;;) {} } |
In the Processor expert under I2C channel 1 the interal frewquency is sent t 5.24288 Mhz this is the lowest frequency that I could select. Here is a picture There is a warning that this device is designed to operate at 100k could this be my problem?
This is the lowest frequency that I could choose
Solved! Go to Solution.
Found the problem look above where I had circled in the original post you can select a clock divider
Thats good...
Found the problem look above where I had circled in the original post you can select a clock divider
Hello Jace Walton
Can you share your full code/I2c part of your code? it may easy to fix issue.
Thanks & regards
Harsh