Skip to main content
Zhiyong Li
Associate
May 16, 2020
Solved

Bug in the official P2P example for S2-LP radios included X-CUBE-SUBG2 package

  • May 16, 2020
  • 1 reply
  • 838 views

As of version 1.1.0 of X-CUBE-SUBG2, file app_x-cube-subg2.c contains two uninitialized pointers.

typedef struct
{
 uint8_t Cmdtag;
 uint8_t CmdType;
 uint8_t CmdLen;
 uint8_t Cmd;
 uint8_t DataLen;
 uint8_t* DataBuff; // This pointer
}AppliFrame_t;

DataBuff of two instances of AppliFrame_t, xTxFrame, xRxFrame, were operated on without initialization.

for (xIndex = 5; xIndex < cRxlen; xIndex++)
 {
 xRxFrame.DataBuff[xIndex] = pRxBuff[xIndex];
 }
for(; xIndex < xTxFrame->DataLen; xIndex++) 
 {
 TxFrameBuff[xIndex+5] = xTxFrame->DataBuff[xIndex];
 }

As a result, the example basically doesn't work. System will just crash upon running. Tested on several NUCLEO boards, F411RE, F070RB, but judging from source code, other nucleo boards will be affected as well, including L152 and L052 boards which are supposedly fully tested.

Given S2-LP radios are basically brand new, we spent hours and hours making sure we followed the instruction correctly to no avail before we started to check the source code of example. This is rather unfortunate.

Update: just dug a little deeper, apparently this bug was carried all the way from early versions of  X-CUBE-SUBG1. I guess those who tried it just swept it under the rug. LOL

This topic has been closed for replies.
Best answer by MGREL

Hello,

Thank you for pointing this out.

That bug is supposed to be fixed starting from X-CUBE-SUBG2 3.0.0.

1 reply

MGREL
MGRELBest answer
ST Employee
January 26, 2021

Hello,

Thank you for pointing this out.

That bug is supposed to be fixed starting from X-CUBE-SUBG2 3.0.0.