PNEV7462C I2C

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
2,334件の閲覧回数
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,254件の閲覧回数
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,277件の閲覧回数
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,269件の閲覧回数
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,265件の閲覧回数
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,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 件の賞賛
返信
2,202件の閲覧回数
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,307件の閲覧回数
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,299件の閲覧回数
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,291件の閲覧回数
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,287件の閲覧回数
MK_Ricard
Contributor II

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

 

thanks

0 件の賞賛
返信
2,284件の閲覧回数
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,313件の閲覧回数
MK_Ricard
Contributor II

Hi, anyone can help me?

0 件の賞賛
返信