[MPC574XG] FreeRTOS Port

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

[MPC574XG] FreeRTOS Port

Jump to solution
3,624 Views
jack_jones
Contributor II

Hello community,

 

I need task handling and TCP/IP support for my application to run.

Therefore I want to use FreeRTOS. I am aware that there is already a port of FreeRTOS for the MPC57XX which can be downloaded from here: MPC574xB/C/D/G|32-bit MCU|Gateway|NXP 

The problem is that this port is not directly usable with the S32 Design Studio.

The port uses own initialization functions (hw_intc.h, hw_pit.h, hw_gpio.h, etc.) and assembler code, which is different from the one in S32.

Nevertheless I managed to get it starting, but the PIT part still makes some problems.

Especially the OS_PlatformInit(). Additionally the prvPortTimerSetup() function in the xPortStartScheduler() in port.c.

If I comment out the OS_PlatformInit() and the prvPortTimerSetup(), I can manage to get one LED up and running as a task. But I guess, as the PIT is not configured, vTaskStartScheduler() cannot change between the tasks.

Here is a screen from the Trace32 Debugger:165197_165197.pngFreeRTOS-support-in-Trace32-Task-List.png

 

It would be great, if someone could guide me, how the PIT and the INTC in conjunction must be configured.

An own S32 project for FreeRTOS would of course be very useful.

 

Best regards,

Jack

Labels (1)
0 Kudos
1 Solution
1,840 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

IVOR8 is system call interrupt.

pastedImage_2.png

Microcontroller doesn't care if FreeRTOS know which interrupt it called.

INTC is hardware, working independantly on SW. SW has to check where the HW is pointing and serve interrupt according to HW event. For more details refer to INTC chapter in reference manual.

IVORx are described of course in core reference manual, as exceptions are part of core.

I suggest you to make simple project as https://community.nxp.com/docs/DOC-104751  and exclude all OS and additional stuff or just use this example and test it.

Than you will have a good overview on how INTC and exceptions are working on MPC57xx.

Peter

View solution in original post

5 Replies
1,840 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

Check the PIT configuration first.

Is PIT running ?

Is PIT set to request interrupt?

pastedImage_1.png

Verify if your PIT on timeout rise TIF flag.

If all conditions above are met, than check IVOR4 handler.

If you set breakpoint on IVOR4 handler on PIT timeout. Code will jump to IVOR4 handler. This means your interrupt is called properly.

If not check your INTC configuration. Correct IVPR placement and IVOR offset.

Peter

0 Kudos
1,840 Views
jack_jones
Contributor II

Hey Peter,

thank you for your reply.

I got the PIT up and running. The PLL was not correctly configured.

Here is a screen of the configured PIT:

FreeRTOS-PIT-config.png

The TIF flag will be set on timeout (see screen above).

But now to the breakpoint and IVOR problematic.

The following screen is taken before the interrupt is performed:

FreeRTOS-before-interrupt.png

The TIF flag is not set, as the timer did not reached 0 until then.

If I want to execute the next line in the program, Trace32 goes into the running mode and everything is blocked.

When I break, the code is at IVOR8 and the TIF flag was set, as can be seen on the next screen:

FreeRTOS-at-IVOR8.png

So the code jumps to IVOR8 and not IVOR4. The question is why?

Is IVOR8 the watchdog interrupt? How can FreeRTOS know, that the interrupt happened?

In the Reference Manual I did not find anything about IVOR, is it under the INTC section?

The INTC configuration is the standard configuration from a fresh MPC5748G project.

Thank you again for your help, I hope we can managed to get it working.

Best regards,

Jack

0 Kudos
1,841 Views
petervlna
NXP TechSupport
NXP TechSupport

Hi,

IVOR8 is system call interrupt.

pastedImage_2.png

Microcontroller doesn't care if FreeRTOS know which interrupt it called.

INTC is hardware, working independantly on SW. SW has to check where the HW is pointing and serve interrupt according to HW event. For more details refer to INTC chapter in reference manual.

IVORx are described of course in core reference manual, as exceptions are part of core.

I suggest you to make simple project as https://community.nxp.com/docs/DOC-104751  and exclude all OS and additional stuff or just use this example and test it.

Than you will have a good overview on how INTC and exceptions are working on MPC57xx.

Peter

1,840 Views
jack_jones
Contributor II

Greetings,

I got it up and running.

In the vector.c file the __external_interrupt_handler for the IVOR4_Handler and for the system call (IVOR8) the vPortYield function must be chosen.

//PPCASMF( e_b   IVOR4_Handler );
PPCASMF( e_b   __external_interrupt_handler );

//PPCASMF( e_b   IVOR8_Vector );
PPCASMF( e_b   vPortYield );‍‍‍‍‍

Thanks for your help.

Best regards,

Jack

1,840 Views
jack_jones
Contributor II

I think I found the pages in the Reference Manual, are these the "Interrupt definitions" starting from page 2951?

0 Kudos