Problem with Serial_LDD Component

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

Problem with Serial_LDD Component

976件の閲覧回数
ricardcomas
Contributor III

Hi everyone, i'm using Serial_LDD component to use Modbus comunication, all works good, but, in the function interrupt "Serial_OnBlockReceive()", the first byte that have to receive from trace Modbus, don't arrive,for example, if somebody send modbus trace to my microcontroler, it doesn't get the trace, but if send again trace to my microcontroller, (2 times) it work correctly, why?¿ first time to receive bytes doesn't work, from 1 once, it work correct.

My microcontroller is MKE04Z128VLK

Thanks!

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

868件の閲覧回数
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Ricard Comas

What code did you place in this part? this event is called when the requested number of data is moved to the buffer, so you don't have to read here, it is more like a flag to indicate that read has finished.  For example, you can have:

main.c

...
volatile bool DataReceivedFlg = FALSE;
...


Error = AS1_ReceiveBlock(MySerialPtr, InpData, 1U);             /* Start reception of one character */

while (!DataReceivedFlg) { }


Event.c

extern volatile bool DataReceivedFlg;

void AS1_OnBlockReceived(LDD_TUserData *UserDataPtr)
{
  DataReceivedFlg = TRUE;  /* Set DataReceivedFlg flag */
}

You could check the "Help on component" option for reference.

Hope this could help.

Best regards

Jorge Alcala

0 件の賞賛
返信