PNEV7462C I2C

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

PNEV7462C I2C

Jump to solution
1,495 Views
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

Tags (2)
0 Kudos
1 Solution
1,415 Views
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

View solution in original post

0 Kudos
11 Replies
1,438 Views
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 Kudos
1,430 Views
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 Kudos
1,426 Views
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 Kudos
1,416 Views
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 Kudos
1,363 Views
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 Kudos
1,468 Views
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 Kudos
1,460 Views
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 Kudos
1,452 Views
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 Kudos
1,448 Views
MK_Ricard
Contributor II

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

 

thanks

0 Kudos
1,445 Views
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 Kudos
1,474 Views
MK_Ricard
Contributor II

Hi, anyone can help me?

0 Kudos