PNEV7462C I2C

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

PNEV7462C I2C

跳至解决方案
2,335 次查看
MK_Ricard
Contributor II

Hi all,

I am tryiing to use I2C Master from this board, but i don't get transmit anything over it, i have the following code:

 

 

uint8_t bBaudRate;
	uint8_t I2C_TXBuffer[5] = {'H','O','L','A','\0'};

	bBaudRate = (uint8_t) ((4000000 / gpkphCfg_EE_HW_I2CM->dwDataRateHz)
	- 4000000);

	phhalI2CM_Config(bBaudRate, 0x09, E_I2CM_7BIT_ADDR_MODE);

	phhalI2CM_Transmit(0x22,5,I2C_TXBuffer);

 

 

Do i need to config anything else before? such as pheriperial clock or similars..?

 

Thanks

标记 (2)
0 项奖励
回复
1 解答
2,255 次查看
KellyLi
NXP TechSupport
NXP TechSupport

Hello @MK_Ricard 

You could try to run this example SW368331\ExamplesPN7462AU\phExHif, and refer it to achieve your application.

 

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.

 

Best regards,

Kelly

Technical Support

NXP Semiconductor

在原帖中查看解决方案

0 项奖励
回复
11 回复数
2,278 次查看
MK_Ricard
Contributor II

Which is the difference between I2CM (Master) and use of hif (i2c) ?¿

i ask because i saw HIF pinout has not pull up resistors which are needed for the I2C master....

0 项奖励
回复
2,270 次查看
KellyLi
NXP TechSupport
NXP TechSupport

Hello @MK_Ricard 

PN7462 has two types of peripherals interface for I2C communication:

– Host interface: I2C supporting standard mode, fast mode, and high-speed mode with multiple

address supports

– Master interface: I2C supporting standard mode, fast mode, fast mode plus, and clock stretching

Hif is for host interface APIs, and I2CM is for master interface APIs.

 

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.

Best regards,

Kelly

Technical Support

NXP Semiconductor

0 项奖励
回复
2,266 次查看
MK_Ricard
Contributor II

Hi thanks for your reply, my code still no works i am using the HIF I2C, i configured all things, and i set the TWO pins to set slave address (pins are zero means 0x28 address regarding datasheet)

 

 

 

	phhalHif_Config_t Hif_I2C;

	Hif_I2C.eInterface = E_HIF_I2C; //I2C Interface
	Hif_I2C.sConfig.sI2cConfig = 0x14; //two BITS ARE 0so Address is 0x28
	Hif_I2C.eBufferType = E_BUFFER_FORMAT_FREE;
	Hif_I2C.bTimeout = 200;
	Hif_I2C.bShortFrameLen = 0;
	Hif_I2C.bHeaderSize = 0;
	Hif_I2C.bStoreErrData = 0;

	phhalHif_ConfigureWaterLevel(1, (pphhalHif_Callback_t)I2C_Water);
	phhalHif_Init(&Hif_I2C, (pphhalHif_Callback_t)I2C_CallBackErrorHandler);
	phhalHif_InitRxBuffer(E_RX_BUFFER_ID0, 20, (uint32_t*)RXBuffer, (pphhalHif_Callback_t)I2C_CallBackRXCompleted);

	while(1);

 

 

 

So, if a device in the BUS send out data to 0x28, my code would to jump to the callback on the function InitRXBuffer()...but it doesnt't do any thing...

 

phhalHif_Init() this function supposed initialize interrupts and pins, any suggestion? i cannot find any demo of Hif I2C neither internet nor NXP website.

 

Sorry to ask heavly, but i need to solve this

 

Thank you so much for your support!

0 项奖励
回复
2,256 次查看
KellyLi
NXP TechSupport
NXP TechSupport

Hello @MK_Ricard 

You could try to run this example SW368331\ExamplesPN7462AU\phExHif, and refer it to achieve your application.

 

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.

 

Best regards,

Kelly

Technical Support

NXP Semiconductor

0 项奖励
回复
2,203 次查看
MK_Ricard
Contributor II

hi, well after these days, i got that HIF can receive data from a host over I2c, but if i want to send a response from HIF I2C, i have to send it across to the I2CM, is it righ? i cannot send a response from HIF I2C,  i saw in the example that in order to transmit data, you have to select a channel which may be I2CM, so i think it confirm to me that it is not possible send a response from I2C HIF, i have to use I2CM to do it, am i right?

 

 

thanks a lot

0 项奖励
回复
2,308 次查看
KellyLi
NXP TechSupport
NXP TechSupport

Hello @MK_Ricard 

Yes, you're right. before phhalI2CM_Config, you should call phhalI2CM_Init to configure the corresponding interface for data transmission. At the same time, there is also advice for you that you can use logic analyzer to monitor the data on the I2C line. It is easy to check whether the data on the line is correct or not. Please try it.

Have a nice day.

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.

Best regards,
Kelly
Technical Support
NXP Semiconductor

0 项奖励
回复
2,300 次查看
MK_Ricard
Contributor II

Now, transmission works, but if i configure it as slave, i cannot receive anything...

Hif_I2C.eInterface = E_HIF_I2C;
	Hif_I2C.sConfig.sI2cConfig = 0x00;
	Hif_I2C.eBufferType = E_BUFFER_FORMAT_FREE;
	Hif_I2C.bTimeout = 4000;
	phhalHif_InitRxBuffer(E_RX_BUFFER_ID0, 10,(uint32_t*)RXBuffer, &I2C_CallBackTXCompleted);
	phhalHif_Init(&Hif_I2C, (pphhalHif_Callback_t)&I2C_CallBackErrorHandler);

 

Slave address is 0x28 due to  the two bits address are zero...is this the right way to do?

0 项奖励
回复
2,292 次查看
KellyLi
NXP TechSupport
NXP TechSupport

Hello @MK_Ricard 

I2C module of PN7462 cannot work on slave, just only configurate to Host or Master mode. Please pay more attention.

 

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.

Best regards,

Kelly

Technical Support

NXP Semiconductor

0 项奖励
回复
2,288 次查看
MK_Ricard
Contributor II

ups…sorry, long time no work on I2C project so i forgot this.

 

thanks

0 项奖励
回复
2,285 次查看
KellyLi
NXP TechSupport
NXP TechSupport

Hello @MK_Ricard 

It's ok, you're welcome.

 

Thank you for your interest in NXP Semiconductor products and for the opportunity to serve you.

Best regards,

Kelly

Technical Support

NXP Semiconductor

0 项奖励
回复
2,314 次查看
MK_Ricard
Contributor II

Hi, anyone can help me?

0 项奖励
回复