In the FSP for the I2C driver, where do I find explanations of the parameters?e.g. I2C channel: is that simply the channel number? 0 or 1?
I2C MASTER RATE FAST has a link, which tells me it is the 400kHz clock. Does it calculate the delays itself from the clock speed?I2C SLAVE EEPROM. What is that? Does it mean the slave address? It can vary depending on how pins 1, 2 and 3 are set on the device being addressed.
p.context. That seems to be the address of itself? Doesn’t it know its own address?
p.transfer-tx, p.transfer-RXD, p.extend. No explanations are offered.
what do I put for p.callback if I don’t want to use a callback function?
Do I need to run IIC-Close after every transaction? If so, does it power down the peripheral or not? It says it “may” do. Does it use the random number generator to decide whether it does or it doesnt?
Thankfully there are a few parameters that are clear: the address and size of the buffer!
Hello Ian,
In general, David explains most of your questions. I want to add some more comments.
First of all, your questions are about FSP architecture, so all the answers can be found on FSP documentation below:
https://www.renesas.com/us/en/document/mas/renesas-flexible-software-package-fsp-v510-users-manual?r=658306
1) p.context is used for providing user-specified data to the callback function. There are cases, that you can use a callback for different modules or channels of the same peripheral, and you want to determine for which module/channel the callback is for. So, inside the callback function, you can pass the control structure in the p_context. Usually, it is avoided to be used.
2)p.transfer-tx,rx are transfer instances for I2C transmit or receive. Instance is a very significant structure on FSP arcihtecture, take a look on the attached screenshot that describes what it is:
3) Ιt isn't mandatory to use callback functions as David mentioned.
4) IIC_close disables all the interrupts, related to IIC peripheral and as David mentioned, you can use it if you don't want to use I2C module anymore on your application.
That configuration page is hard to find. Is there an easier link than Window->Show View->Properties ?i thought that the “info” link on the stack led to the relevant page of the FSP manual, but it only shows some of the manual. (That manual could use a copy editor - a few well-placed page breaks would make a huge difference!) However, it doesn’t tell me the difference between short and long timeout mode!I also see that the block of code it generates appears in hal-data.c, and it is the same block as included in the “example code”
The info link is a very good and fast way to have direct access to a specific stack (for example I2C).
Your initial questions were more general on how FSP drivers work, that's why I sent the aforementioned link.
Yes, every user's step during FSP configuration is stored on hal_data.c, that is an auto-generated fie, after clicking Generate project content.
Please, could you define what you mean short and long timeout mode?
Best Regards
In David’s screenshot (above) panel on the right, 14th line.
Well, I2C peripheral includes timeout function that uses an internal counter, and inform the system when a specific time interval has passed without SCL line change state.
If SCL changes state, the timeout function resets the counter, in differenr case a counter overflow is happens.
Short mode means that the counter will be a 14-counter, while long mode means that the counter will be 16-bit. The count source of the counter is the internal reference clock that is configured through CKS[2:0] bits on ICMR1 register.
Regarding the screenshots above, if you know the PCLKB clock frequency (please ignore 50Mhz, because the screenshot is from diffenrent mcu) and also you know the CKS configuration ( you can see the value for CKS bits on the hal.data.c file), you can calculate the time interval of a counter cycle.
The next step is to decide if you prefer to have short or long mode. On short mode, the counter will measure up to 2^14*time interval = 16384*time interval until an overflow happens, while on long mode the counter will measure up to 2^16*time_interval = 65536*time intrval until an overflow happens.
It's your decision, what you will select.
Regards,
AL_Renesas
Thanks,
If you don't have anything else to ask about this request, can you please verify my answer for other members of Community?