I have the above mentioned board and tried the builtin uart demo which use LINFlexD and I using Termite as terminal setting the baud rate to 19200 just as it was set in the source code, but when I run it with debuger in S32DS then nothing will be printed to the terminal. Tested the terminal software, it is working with an arduino UNO so the problem should be elsewhere.
What I found out that my board is a revision E which somewhat differ from B. There is a documentation which even mention the following " USB/serial/OpenSDA is connected to LIN0 (LIN1 on Rev.B) ". It could be that the original program was written to the B version? I can't verify this since I'm quite a beginner with this board and not sure what exactly going on in the source.
The example name is "LINFlexD_UART_MPC5744P" by the way
UPDATE: So my assumption is that if with rev E the serial is connected to LIN0 (LINFlexD_0), then I should call thats initialization function, because its exists there, it just unused. But as soon as the control enter to that function it will run into an interrupt IVOR1_Vector where it stays for ever (like a trap mechanism in TriCore I assume), but I am unsure what the meaning of this "trap".
Hi,
most probably the exception will be called due to clock gated on LINFlex_0. Add below line to peri_clock_gating()
MC_ME.PCTL204.B.RUN_CFG = 0x1; //LINFlexD_0: Select peripheral config RUN_PC[1]
Then use LINFlex0 functions
initLINFlexD_0(80,19200);
testLINFlexD_0(); /* Send test message to PC terminal.*/
for(;;)
{
echoLINFlexD_0();
}
BR, Petr
Just wanted to share my experience after first 8 hours using Revision E board..
I now have the UART example working for LINFlexD_0 and LINFlexD_1.
LinFlexD_0
In addition to correcting the peripheral clock as described by @PetrS
The example still crashes. This is because the code for testLINFlexD_0 makes a reference to LINFlex1 for RX.
void testLINFlexD_0( void ) { /* Display message to terminal */
int i, size, j;
uint8_t result[sizeof(message_0)-1] = {0};
size = sizeof(message_0);
/* Send to LINFlex_1. */
for (i = 0; i < size; i++) {
txLINFlexD_0(message_0[i]); //Send from LINFlex_0
result[i] = rxLINFlexD_1(); //Get the character from LINFlex_0
Once this is also corrected, the example works. Note, that the example will only transmit one character then expects to receive a character.
LinFlexD_1
If using the default example, then the UART is not connected to the open SDA debug chip. Therefore you will have to use your own serial cable to connect to the terminal program. The signals will come out of connector J3. However - what got me here was not realising that the board ships with Jumper J175 set to rout the signals to the end LIN connector. - This is 12v and not TTL RS232.
Swap jumper J175 and use signals from connector J3.
Hope this helps someone else, as it took me a while to figure all these small issues out. I only found this post, when I tried to make a similar post.
It is disappointing that the examples contain bugs and missing code. Especially as the examples I refer to were downloaded for the Revision E board (From the getting started web page). These should be updated to just work on the Revision E board, and a few comments relevant to the dev board would of made this a 10 minute task.