Problem with lpspi + Freertos

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

Problem with lpspi + Freertos

540件の閲覧回数
Mit_3000GT_VR4
Contributor II

Hi,

I have problem with lpspi driver from SDK.

It sometimes generates an assert. Tracing, It comes to this function. (copy from the SDK driver)

static uint32_t LPSPI_CombineWriteData(uint8_t *txData, uint8_t bytesEachWrite, bool isByteSwap)

{

assert(txData != NULL);

uint32_t wordToSend = 0U;

switch (bytesEachWrite)
{
case 1:
wordToSend = *txData;
++txData;
break;

case 2:
if (!isByteSwap)
{
wordToSend = *txData;
++txData;
wordToSend |= (unsigned)(*txData) << 8U;
++txData;
}
else
{
wordToSend = (unsigned)(*txData) << 8U;
++txData;
wordToSend |= *txData;
++txData;
}

break;

case 3:
if (!isByteSwap)
{
wordToSend = *txData;
++txData;
wordToSend |= (unsigned)(*txData) << 8U;
++txData;
wordToSend |= (unsigned)(*txData) << 16U;
++txData;
}
else
{
wordToSend = (unsigned)(*txData) << 16U;
++txData;
wordToSend |= (unsigned)(*txData) << 8U;
++txData;
wordToSend |= *txData;
++txData;
}
break;

case 4:
if (!isByteSwap)
{
wordToSend = *txData;
++txData;
wordToSend |= (unsigned)(*txData) << 8U;
++txData;
wordToSend |= (unsigned)(*txData) << 16U;
++txData;
wordToSend |= (unsigned)(*txData) << 24U;
++txData;
}
else
{
wordToSend = (unsigned)(*txData) << 24U;
++txData;
wordToSend |= (unsigned)(*txData) << 16U;
++txData;
wordToSend |= (unsigned)(*txData) << 8U;
++txData;
wordToSend |= *txData;
++txData;
}
break;

default:
assert(false);                                          // ASSERT RIGHT HERE
break;
}
return wordToSend;

}

Please help if you have the same problem.

Thanks

ラベル(1)
タグ(1)
0 件の賞賛
1 返信

490件の閲覧回数
FelipeGarcia
NXP Employee
NXP Employee

Hello,

 

The assert you are referring means that bytesEachWrite has a different value that any of the cases in the switch (1, 2, 3, 4). I recommend you to track down which part of your code is not setting bytesEachWrite correctly to know what is really happening in this situation.

 

Best regards,

Felipe

0 件の賞賛