AnsweredAssumed Answered

Problem when transfering Data between 2 UART Ports

Question asked by Jerry MAO on Sep 1, 2017

Hi,

 

im try to transfer Data through 2 UART ports. but the problem is only the first element of the Data received.

my model is like this. sent [50 1 1 52]or[50 2 2 52] through USART1 and receive it from USART3.

Both USART buffer size is 4

ToolChain used is EWARM.

 

   Matlab Function: generateBuff

   function [NbChar, Buff] = generateBuff(u1)

   if coder.target('Sfun')
      % Executing in MATLAB, Buff is null
      Buff = uint32(0);
      NbChar = uint16(0);

   else
      % Executing in the generated code.
      Buff = uint32(0);
      Buff = coder.ceval('getBuffPtr',uint8(u1));
      [nbChar,~] = size(u1);
      NbChar = uint16(nbChar);

   end
  end

 

i expect to receive[50 1 1 52], but actually i receive [50 0 0 0], like below

 

usart1TestRcvChar_B.USART_Receive_o3 = ['2'(0x32),'\0'(0x00),'\0'(0x00),'\0'(0x00)]

 

where shoud i modified?

Outcomes