Problem with printf() in S32DS with MPC5748G

Showing results for 
Search instead for 
Did you mean: 

Problem with printf() in S32DS with MPC5748G

Contributor I

I am using MPC5748G devkit board, and would like be able to use the printf() function to be able to see some output. I found this howto: How to use printf function in S32DS for Power Architecture using EWL library  but can't get it working with  the board. I don't get any warnings so it is difficult to debug. I am kind of lost...

Basically what i did was:

1. I added the uart.c and uart.h to the project /src and /include folders, to the Z2_2 core folders to be specific (I downloaded the files from the link above).

2. I changed the header file in uart.c to #include "MPC5748G.h".

3. I copied the uart_console_io.c file (from the /S32DS_Power_v2.1\S32DS\build_tools\e200_ewl2 folder) to the /src folder of the project

4. I added few lines to the main.c of the Z2_2 core,. It looks now like this.

#include "derivative.h" /* include peripheral declarations */
#include <stdio.h>
extern void xcptn_xmpl(void);
int main(void)
 volatile int counter = 0;
 xcptn_xmpl ();              /* Configure and Enable Interrupts */
 printf("Hallo world. this is a printf example.\n")
 /* Loop forever */
 for(;;) {    

5. I set up a Putty to operate on serial terminal with this settings: Baudrate 19200; Data bits 8; Stop bit 1; no parity, no flow control.

6. I built the project (see below) and run it in the debugger.

The project would not build with the HW_Init() function call. So i deleted it, although I don't know what it does... After that the project runs (I am using the S32DS debugger to run all the cores in RAM mode), but I can't see any output on the terminal (I checked also some other app for serial port monitoring).

My questions are:
1. The board has three cores. The code similar to the one in the example is only in main.c on the Z2_2 core. Does it mean that all code from all cores will run if I simply debug the code? Or do i have to call some functions on the boot core to make other cores run their programs?

2. If I wanted to run this program with one of the other core, how could I do that? The main.c from the other cores looks different (it is empty), and pasting the code over there results in many errors (even after adjusting all the references to header files).

3. In the windows tool manager the COM4 port is set up to 9600, although in the example I am using a higher baud rate. Could this be a problem? How to change the baud rate in the given program?

4. Why doesn't the program work?

Thanks in advance for any suggestions!

0 Kudos
1 Reply

NXP TechSupport
NXP TechSupport

Hi Lukas,

1. Main boot core is Z4A. Other cores may be started either using boot header (see "57.1.3 Search boot header and boot options" in the reference manual), so all cores start execution out of reset, or you can start them by software running on Z4A (function like mentioned hw_init).

2. When you create new multicore project in S32DS, there are three separate projects - one for each core. If you want to use printf on all cores, you need to add the files to all three projects separately. That also means that you are going to share the resources between cores (LINFlex module in this case). So, you would have to use different LINFlex modules (three UARTs in other words) or you would have to manage the sharing using semaphores or something like that.

3. and 4. Can't really say. As a first step, I would use an oscilloscope to see what comes out of the LINFlex module.



0 Kudos