MKE18F512 LPI2C not Work

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MKE18F512 LPI2C not Work

1,086件の閲覧回数
shenjian
Contributor II

I use MKE18F512   LPI2C  to drive the PCA9555 ,is I2C to 16 GPIO, I use SDK_2.6.0_MKE18F512xxx16  

the IDE is MDK Keil 5.14

the demo modify from SDK_2.6.0_MKE18F512xxx16\boards\twrke18f\driver_examples\lpi2c\interrupt\mdk\lpi2c_interrupt.uvprojx

but it not work,can anybody help me? thanks!

ラベル(1)
タグ(1)
0 件の賞賛
返信
1 返信

1,011件の閲覧回数
shenjian
Contributor II

I did something wrong. this file is right

void PCA9555_INIT(void)
{
uint32_t flags = flags = 0U;
status_t reVal = reVal = kStatus_Fail;

lpi2c_master_config_t masterConfig = {0};

LPI2C_MasterGetDefaultConfig(&masterConfig);
masterConfig.baudRate_Hz = LPI2C_BAUDRATE;

LPI2C_MasterInit(LPI2C1, &masterConfig, CLOCK_GetIpFreq(kCLOCK_Lpi2c1));

g_master_buff[0] = 0x06;
g_master_buff[1] = 0x00;
g_master_buff[2] = 0x00;

{
reVal = LPI2C_MasterStart(LPI2C1, PCA9555ADDR, kLPI2C_Write);

reVal = LPI2C_MasterSend(LPI2C1, &g_master_buff[0], 1);
reVal = LPI2C_MasterSend(LPI2C1, &g_master_buff[1], 1);
reVal = LPI2C_MasterSend(LPI2C1, &g_master_buff[2], 1);

reVal = LPI2C_MasterStop(LPI2C1);
}
}

0 件の賞賛
返信