I2C internal Freq (Multiplier Factor)

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

I2C internal Freq (Multiplier Factor)

跳至解决方案
2,205 次查看
jacewalton
Contributor III

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? 

 

175330_175330.pngpastedImage_6.png

This is the lowest frequency that I could choose

175337_175337.pngpastedImage_7.png

标签 (1)
0 项奖励
回复
1 解答
1,990 次查看
jacewalton
Contributor III

Found the problem look above where I had circled in the original post you can select a clock divider 

在原帖中查看解决方案

0 项奖励
回复
3 回复数
1,990 次查看
harshpatel
Contributor IV

Thats good...

0 项奖励
回复
1,991 次查看
jacewalton
Contributor III

Found the problem look above where I had circled in the original post you can select a clock divider 

0 项奖励
回复
1,990 次查看
harshpatel
Contributor IV

Hello Jace Walton

Can you share your full code/I2c part of your code? it may easy to fix issue.

Thanks & regards

Harsh

0 项奖励
回复