How can I activate an eMIOS channel in DAOC mode in my MPC5777C micro?

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

How can I activate an eMIOS channel in DAOC mode in my MPC5777C micro?

Jump to solution
1,882 Views
jorgemartinez7
Contributor II
Hello,

I’m using the MPC5777C micro in an NXP EVB and I’m trying to activate an EMIOS channel in DAOC mode, I think I have followed the directions of the user manual, but I can not make it to work. For me at this moment seems like DAOC is not enabled in this microcontroller.
I have some basic experience with EMIOS, because I have successfully enabled EMIOS channels in these modes: MC, SAOC, OPWFM, SAIC, IPM, IPWM, but this mode is not working for me.
If possible please let me know your thoughts of what is wrong with my configuration or understanding of this EMIOS mode.
The specific features and configurations details:
This test software is done for the NXP EVB and is configured to use the 16 MHz Internal RC Oscillator (IRC), this means the nominal per_clk operating frequency is 8 MHz or 125 microseconds period, this is the sys-clock for EMIOS-0.
CONFIG-0: Set eMIOS 0 channel 23 with these settings:
Configured in MC mode, with these specific settings
  •Modulus Counter = 0x10
  •Up mode
  •Internal counter
  •With clear on match start
  •Interrupt enabled.
  •Only one flag generated on A match
  •For 200 Hz operating frequency, with an input clock of 8MHz, the required counts for REG-A = 8MHz/200Hz = 40000 counts = 0x9C40 counts.
CONFIG-1: Set eMIOS 0 channel 21 with these settings:
Configured in DAOC mode, with these specific settings
  •Pulse polarity: Positive Pulse = EDPOL= 1
  •Use Global Counter Bus A.
  •Rising edge shall be 1 millisecond after enabling the global time base, this means REG-A is initialized to 1msec/125microsec = 8000 = 0x1F40 counts (I think this value is valid because is smaller than EMIOS0-CH23-REG-A=0x9C40)
  •Falling edge shall be 3 milliseconds after enabling the global time base, this means REG-B is initialized to 3msec/125microsec = 24000 = 0x5DC0 counts (I think this value is valid because is smaller than EMIOS0-CH23-REG-A=0x9C40)
  •Interrupt enabled.
  •Only one flag generated on B match
CONFIG-2: Set PCR200 /EMIOS0-CH21 pin port with these settings:
  •In primary mode (EMIOS)
  •Output mode
CONFIG-3: Set PCR199 pin port with these settings:
  •In GPIO mode
  •Output mode
CONFIG-4: Set PCR201 pin port with these settings:
  •In GPIO mode
  •Output mode
CONFIG-5: eMIOS0-> CH21 & eMIOS0-> CH23 ISRs are:
  •Configured
  •Enabled
  •Lowest priority set: 1

Detailed functional description and sequence of events
1.Global prescaler is disabled
2.PCR199 pin port configured as CONFIG-3
3.PCR201 pin port configured as CONFIG-4
4.PCR200 pin port configured as CONFIG-2
5.EMIOS0-CH23 is configured as CONFIG-0
6.EMIOS0-CH21 is configured as CONFIG-1
7.ISRs for EMIOS0-CH23 & EMIOS0-CH21 are configured as CONFIG-5
a.GPIO201 configured to toggle high and low whenever the EMIOS0-CH23-ISR is executed.
b.GPIO199 configured to toggle high and low whenever the EMIOS0-CH21-ISR is executed.
8.Enable global prescaler and global time base
9.No other interrupts or functions are executed.
The expected result:
EMIOS0-CH21 working on DAOC mode with a single positive pulse of 2 milliseconds
EMIOS0-CH21 toggling at the falling edge of EMIOS0-CH21->DAOC pulse
GPIO201 is toggling at 200 Hz because is toggled by EMIOS0-CH23-ISR in MC up mode at 200 Hz frequency.
The actual test results:
EMIOS0-CH21 always stays high after the DAOC mode is enabled.
GPIO201 is toggling at 200 Hz (EMIOS0-CH23 in MC up mode at 200 Hz frequency).
Other tests I have done:
  1.I tested different values for EMIOS0-21 REG-A and REG-B, with no difference.
  2.I tested to use the internal counter as counter bus for the EMIOS0-21 but did not make any difference.
  3.I tested successfully other EMIO mode (OPWFM) in the same pin port, this means the pin port is working fine and is properly configured.
  4.I tested the same software with different values for EMIOS0-CH21.IC->EDPOL and EDSEL registers but there was no actual difference.

I attached:
  1.Register values of EMIOS and SIU after the software is ran for some time. (registers.txt)
  2.Oscilloscope snapshots (tek00000-00005.png) of the initial time when the software is executed, this is the meaning of the channels:
    a.CHANNEL-1= GPIO201
    b.CHANNEL-2=EMIOS0-CH21
    c.CHANNEL-3=GPIO199
    In the scope images is clear that:
    EMIOS0-CH23 is working fine in MC up mode at 200 Hz.
    EMIOS0-CH21 is just in active high right after this EMIOS-DAOC channel is enabled by the global plescaler and global enabler.
Additional details:
1.The EVB hardware setup we are using:
  a.Daughter board: 700-28088 REV C, SCH-28088 REV D
  b.Mother board: 700-27237 REV D, SCH-27237 REV C
2.The used microcontroller user manual: “MPC5777C Reference Manual, Rev. 3, 02/2015”
3.The microcontroller has this label in the package: “SPC5777CDMM03   3N45H   CTA01738D”
Tags (3)
1 Solution
1,769 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you did not share the code so be sure comparators are enabled. You need to write to A/B registers after DAOC mode is selected. After match comparators are disable again, to enable it you need to write to A/B registers again.

BR, Petr

View solution in original post

2 Replies
1,770 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

you did not share the code so be sure comparators are enabled. You need to write to A/B registers after DAOC mode is selected. After match comparators are disable again, to enable it you need to write to A/B registers again.

BR, Petr

1,770 Views
jorgemartinez7
Contributor II

Hi BR, Petr,

Thank you very much for your help!

The problem was I set the registers A/B first and then the channel mode. Actually I was following the instructions in the section: "36.7.2.3 Channel/Modes Initialization" of the microcontroller user manual:

MPC5777C Reference Manual, Rev. 3, 02/2015

36.7.2.3 Channel/Modes Initialization
The following basic steps summarize basic output mode startup, assuming the channels
are initially in GPIO mode:
1. [global] Disable Global Prescaler.
2. [timebase channel] Disable Channel Prescaler.
3. [timebase channel] Write initial value at internal counter.
4. [timebase channel] Set A/B register.
5. [timebase channel] Set channel to MC(B) Up mode.
6. [timebase channel] Set prescaler ratio.
7. [timebase channel] Enable Channel Prescaler.
8. [output channel] Disable Channel Prescaler.
9. [output channel] Set A/B register.
10. [output channel] Select timebase input through BSL[1:0] bits.
11. [output channel] Enter output mode.
12. [output channel] Set prescaler ratio (same ratio as timebase channel).
13. [output channel] Enable Channel Prescaler.
14. [global] Enable Global Prescaler.
15. [global] Enable Global Time Base.

My advice is to reflect the required register initialization order in future versions of the microcontroller user manual, without that other people may face the same problem I did.

After changing the order: write eMIOS mode first, then write A/B register: DAOC mode is finally working!

tek00005.png

In the image I have a negative pulse of 2 milliseconds generated by an EMIOS channel working in DAOC mode (seen in the oscilloscope channel 2.)

Have a good day

Jorge

0 Kudos