Hi all,
I am configuring the FlexCAN peripheral Message Buffers and I have notices that a lot of APIs description in the User Manual are not correct or exaustive.
For example, API FlexCAN_SetMsgBuffIntCmd description is aligned the old SDK onces, but RTD version entry point is totally different.
Could someone explain the difference between parameters "enable" and "bIsIntActive" highlighted in the screen and not distinguished in the parameters table?
Solved! Go to Solution.
Hi,
if you call init with FlexCAN_Ip_Init(INST_FLEXCAN_0, &FlexCAN_State0, &FlexCAN_Config0) then last parameter in FlexCAN_SetMsgBuffIntCmd should be FlexCAN_State0.isIntActive.
BR, Petr
Hi,
this function is called internally by driver. The "Enable" specifies if respective MB bit in IMASK register will be set or not, so enabling interrupt for given MB. The "bIsIntActive" is data field of internal drive state variable/structure (Flexcan_Ip_StateType), and save status of enabling/disabling interrupts in runtime. bIsIntActive is set within FlexCAN_Ip_Init function.
BR, Petr
Hi,
enable parameter meaning is clear, but I cannot say the same for the bIsIntActive parameter.
I am writing a simple API interfacing with FlexCAN RTD
int16_T CAN_BufferConfig (uint8_T Channel,
uint8_T bufferNumber,
uint8_T direction,
uint8_T size,
uint8_T IDtype,
uint32_T msgId,
uint32_T int_en)
{
int16_T error;
Flexcan_Ip_StateType * state = Flexcan_Ip_apxState[Channel];
/* configure the Mailing Box, message direction, CAN ID value, CAN ID type, etc */
...
At the moment my API, before the return, performs
/* Enable MB interrupt if required*/
result = FlexCAN_SetMsgBuffIntCmd(base,Channel,nbuf,TRUE,int_en);
but considering your answer the correct way should be:
/* Enable MB interrupt if required*/
result = FlexCAN_SetMsgBuffIntCmd(base,Channel,nbuf,int_en, state->bIsIntActive );
Is it correct?
B.R.
I have to correct my self
Flexcan_Ip_apxState[Channel];
is static with scope limited to FlexCAN_Ip.c module.
So which state have I to use as last etry point for FlexCAN_SetMsgBuffIntCmd API?
Hi,
FlexCAN_SetMsgBuffIntCmd is not public API too, FlexCAN_IP drive is calling it when Send/receive function is used, yu can refer to those functions.
I placed simple RTD code on https://community.nxp.com/t5/S32K-Knowledge-Base/Example-S32K344-FlexCAN-Ip-TX-RX-EnhanceRXFIFO-test...
BR, Petr
Yes I kown.
To be precise, it is defined in FlexCAN_Ip_HwAccess.h but "inlined" by multiple translation units by NXP RTD implementation, FlexCAN_Ip/FlexCAN_Ip_HwAccess.c modules.
So, why cannot I use it in my translation unit?
Moreover, we have always configured MB for reception by polling or by ISR one time on ECU startup, for sure not each time we have to send or receive a message.
Hi,
if you call init with FlexCAN_Ip_Init(INST_FLEXCAN_0, &FlexCAN_State0, &FlexCAN_Config0) then last parameter in FlexCAN_SetMsgBuffIntCmd should be FlexCAN_State0.isIntActive.
BR, Petr