MPC5748G & OBD chip communicating through UART (UART is struck)

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

MPC5748G & OBD chip communicating through UART (UART is struck)

1,737件の閲覧回数
polisetty
Contributor II

LINFLEXD_UART_DRV_ReceiveData(INST_LINFLEXD_UART3, OBD_Rxbuffer, 1U);
/* Wait for transfer to be completed */
while(LINFLEXD_UART_DRV_GetReceiveStatus(INST_LINFLEXD_UART3, &bytesRemaining) == STATUS_BUSY);

UART is configured to enable transmission between OBD chip and microcontroller. Even after receiving the data in the buffer, it is waiting for reception to complete and the status is busy.

Kindly help me, to find out how to come out of the while loop.

 

0 件の賞賛
返信
7 返答(返信)

1,719件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

after receiving single byte it should pass while loop.

Maybe you can refer to uart_pal_mpc5748g example. It continuously stores received bytes into wide buffer until it is full or special character is received.
RX callback is used and SetRxBuffer function is called to update buffer for continuous reception.

BR, Petr

0 件の賞賛
返信

1,690件の閲覧回数
polisetty
Contributor II

Hi,

In this  i am using LINFlexD module.

check the line number 84, in that loop ,Always it is waiting for reception to complete and the status is busy.

Kindly help me, to find out how to come out of the while loop.

 

1122

0 件の賞賛
返信

1,657件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

seems you are using rx callback as well, so did you enter OBDRxCallback when character is received?
I guess so as you wrote buffer is updated.
Do you use SetRxBuffer function in your code to update buffer for continuous reception? If yes simply do not call it again when you want to stop continuous reception. Refer to uart_pal example.

BR, Petr

0 件の賞賛
返信

1,648件の閲覧回数
polisetty
Contributor II

Hi,

As you said , I have removed the SetRxBuffer function in callback function and placed  before the 84 th line  then it is not stucking in the while loop and it is transmitting continuously.

BUT the problem is, In the OBD_Rxbuffer I am not getting the data .

Then, I have modifed  the SetRxBuffer size 1U to sizeof(OBD_Rxbuffer).

LINFLEXD_UART_DRV_SetRxBuffer(INST_LINFLEXD_UART3, &OBD_Rxbuffer[OBD_RxbufferIdx], sizeof(OBD_Rxbuffer));

Then , it is transmitting only one time and that one I am getting data in the OBD_Rxbuffer.

so what are the changes I have to made , to transmit continuously and I want data in the OBD_Rxbuffer.

kindly help me in this regard,

Polisetty Akhil.

0 件の賞賛
返信

1,589件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

not sure how OBD data should be handled. If you want to receive data continuously you can do it in similar manner as is in uart_pal example, that is byte by byte reception. In callback you can determine if another byte should be received or not, SetRxBuffer is used to update buffer and so continuous reception is done. if not called reception is stopped. While loop can be changed to "if" statement, if you do not want to stop there. LINFLEXD_UART_DRV_ReceiveData is called to start new reception.

BR, Petr 

0 件の賞賛
返信

1,571件の閲覧回数
polisetty
Contributor II

Hi,

I have implemented what you said,

Now it is showing STATUS_UART_FRAMING_ERROR While I am receiving data form the OBD and it will display in the UART.

How to solve that problem ?

0 件の賞賛
返信

1,518件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport
0 件の賞賛
返信