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
解決済! 解決策の投稿を見る。
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
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....
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
Hi thanks for your reply, my code still no works
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!
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
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
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
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?
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
ups…sorry, long time no work on I2C project so i forgot this.
thanks
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
Hi, anyone can help me?