Clock Config in S32DS for MPC5777M

cancel
Showing results for 
Search instead for 
Did you mean: 

Clock Config in S32DS for MPC5777M

Jump to solution
717 Views
thomasolenik
Contributor III

I'm just getting started with the MPC5777M in S32 Design Studio and of course one of the first steps is configuring the clocks. The project generation wizard generates a MPC5777M.h header file and I see the MC_CGM macros. However, when I try to drill down through the project I don't actually see the registers being addressed. For example, I can see in the MPC5777M reference manual that I need to set the MC_CGM_SC_DC3 register at address offset of 0x7F4.  MPC5777M.h has a macro that defines MC_CGM_SC_DC3 as MC_CGM.SC_DC3.R, but I don't see where MC_CGM_SC_DC3 actually points to the register address. Is this something that is just hidden?

 

I have read AN4812 on initializing the clock, but the example seems specific to the Green Hills IDE. In the example given for the register I mention above there is the following line:

MC_CGM.SC_DC[3].R=0x80010000;

 

So in S32DS would the equivalent be:

MC_CGM.SC_DC3.R=0x80010000;

 

I guess from a more general perspective, I'm just trying to better understand making best use of the MPC5777M.h header in my projects.

Labels (1)
1 Solution
413 Views
martin_kovar
NXP Employee
NXP Employee

Hi Thomas,

I am sorry, I did not completely understand the main idea of your first question. If you want to access to whole MC_CGM_SC_DC3 register, you simply use the construction which you mentioned above or this construction because of define:

MC_CGM.SC_DC3.R = 0x80010000;

#define MC_CGM_SC_DC3   MC_CGM.SC_DC3.R

But if you want to use bit access, you have to use following construction:

MC_CGM.SC_DC3.B.DE = 0x1;

MC_CGM.SC_DC3.B.DIV = 0x1;

For correct understanding, how to use header files, look at the application note in the attachment.

Regards,

Martin

View solution in original post

4 Replies
413 Views
martin_kovar
NXP Employee
NXP Employee

Hi Thomas,

MPC5777.h file does not contain register offsets. There is only absolute address of each module and the "offset" is provided by defined structures and unions of each module. But if you want use header file from GreenHills IDE, you can import it to S32DS instead of the default header files.

Regards,

Martin

0 Kudos
413 Views
thomasolenik
Contributor III

Martin,

Thanks for the quick answer. I don't want to use the GreenHills header. I want to use the MPC5777M.h header that is generated by S32 Desing Studio. I'm just trying to understand how best to use that header since I'm just getting started with it. I don't see where the MPC5777M.h header leads to any addresses.

A more direct question would be that would help me understand how it is intended to be used:  How would I set the MC_CGM_SC_DC3 register to 0x80010000?

Is it simply:

MC_CGM_SC_DC3 = 0x80010000;

While that makes sense to me, I was trying to verify the register address in the source code provided. 

Thanks,

Tom

0 Kudos
414 Views
martin_kovar
NXP Employee
NXP Employee

Hi Thomas,

I am sorry, I did not completely understand the main idea of your first question. If you want to access to whole MC_CGM_SC_DC3 register, you simply use the construction which you mentioned above or this construction because of define:

MC_CGM.SC_DC3.R = 0x80010000;

#define MC_CGM_SC_DC3   MC_CGM.SC_DC3.R

But if you want to use bit access, you have to use following construction:

MC_CGM.SC_DC3.B.DE = 0x1;

MC_CGM.SC_DC3.B.DIV = 0x1;

For correct understanding, how to use header files, look at the application note in the attachment.

Regards,

Martin

View solution in original post

413 Views
thomasolenik
Contributor III

Outstanding! Exactly what I was looking for. I just got spoiled by PE in KDS.

Thank You!