question about unified bootloader demo intrrupt Receiving

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

question about unified bootloader demo intrrupt Receiving

ソリューションへジャンプ
843件の閲覧回数
Huan89898989
Contributor I

In the unified_bootloader_demo program. In interrupt, the program passes the received data into the TP layer before calling CAN_Receive. I'm not sure if this makes sense because the data coming into the TP layer is the same data that was received in the last interrupt. Should we swap CAN_Receive and TP_DriverWriteDataInTP sequentially

void CAN_ISR_Callback(uint32_t instance,
        can_event_t eventType,
        uint32_t objIdx,
        void *driverState)
{
	if(CAN_EVENT_RX_COMPLETE == eventType)
	{
		TP_DriverWriteDataInTP(g_RXCANMsg.id, g_RXCANMsg.length, g_RXCANMsg.data);
		CAN_Receive(&can_pal1_instance, 1, &g_RXCANMsg);
	}
	else if(CAN_EVENT_TX_COMPLETE == eventType)
	{
		TP_DoTxMsgSuccesfulCallback();
	}
	else
	{}
}

 

0 件の賞賛
返信
1 解決策
816件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

it is correct usage this way. CAN_Receive was called at beginning and within ISR/callback a g_RXCANMsg contains received data, so it is passed to higher layer. Then CAN_Receive is called to start receiving again. In fact it reenables MB interrupt and update internal status variable.

BR, Petr

元の投稿で解決策を見る

4 返答(返信)
817件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

it is correct usage this way. CAN_Receive was called at beginning and within ISR/callback a g_RXCANMsg contains received data, so it is passed to higher layer. Then CAN_Receive is called to start receiving again. In fact it reenables MB interrupt and update internal status variable.

BR, Petr

813件の閲覧回数
Huan89898989
Contributor I

Thanks for your answer, I seem to have a little misunderstanding about the function of CAN_Receive. When a program starts calling CAN_Receive, it seems to be ready to receive data, rather than necessarily calling CAN_Receive when it wants to receive data. Am I getting this right? It seems I need to know more about the mechanism of CAN_Receive

0 件の賞賛
返信
794件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

in fact FlexCAN module is able to receive message after CAN_ConfigRxBuff is called. This will prepare the selected MB to accept message with defined ID. A CAN_Receive then update driver's status variable and enable MB interrupt. Once message is received interrupt is called, data moved into given user buffer, MB interrupt disabled, driver's status variable updated and callback called. Within callback user process es data in user buffer and call CAN_Receive again to enable MB interrupt etc.
Ideally CAN_Receive should be called before each message will come. 
 

BR, Petr

0 件の賞賛
返信
783件の閲覧回数
Huan89898989
Contributor I
Thanks Petr, I think I have understood the part about CAN_Receive opening interrupts, so the logic of the program should flow smoothly
0 件の賞賛
返信