How to set Status_reg_uc0 Registers (0x105)

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

How to set Status_reg_uc0 Registers (0x105)

14,017 Views
uzza9
Contributor III

I have implemented injector control firmware by using MC33816 with S32K144 MCU successfully i.e. that
    1. controls Source HS and Drain LS
    2. it generates an automatic interrupt respectively for that abnormal event occurs
as expected.

Now I am trying to identify which fault condition causes the automatic interrupt.

I think that ProcessAutomaticInterrupt() in MC33816_irq.c checks the status register (0x105) to figure out which INJ causes the automatic interrupt as shown below;

    void ProcessAutomaticInterrupt()
    {
        ...

        // ERROR uc0ch1
        if ((auto_irq & 0x1) == 1) // Error occurred on uc0ch1
        {
            status = send_single_SPI_Cmd(READ, ch1_status_reg_uc0, 0x00); // Read Status register 105h uc0ch1 to check which injector failed
            if ((status & 0x1) == 1) // INJ1 fails b0 at 1
            {
                inj1_error++;
                AutoErrStatus = AutoErr(INJ1); // Check which fault happened
                if (inj1_error > auto_retry) // Shutdown INJ1
                {
                    send_single_SPI_Cmd(WRITE, ch1_ctrl_reg_uc0, 0x40); // Clear the fault by writing the control register b6
                    flag_start1_fail = 1; // Put start1 flag high in order to stop Start1 pulse
                }
            else
            {
                ...
            }
        }
        if ((status & 0x2) == 2) // INJ2 fails b1 at 1
        {
            ...
        }
    }
 

However I don't know how to set the bits of the status register (0x105) e.g. set bit 0 of the register to figure out INJ1 failure by ProcessAutomaticInterrupt().

I was trying to set the bit in MicroCode for the MC33816 as follows;
    irq_auto:             stos off off off;                 * Disable drivers
                                 endiaga diagoff;             * Disable automatic diagnostic
                                 stirq low;                           * Set the low IRQB pin
                                 stf high BstFlag;               * Set flag0 high DCDC active
                                 stsrb high AutoIrqBit;      * Set status register bit 5 when automatic diagnosis interrupt trig
                                 stsrb high b0;                   * Set status register bit 0 when INJ1 error. how to set and if conditions ???

                                 stsrb high b1;

Unfortunately it did not work, and moreover it is very hard to get technical info of how to handle the conditions if INJ1 failed or INJ2 failed in the MC33816 MicroCode.

Can you please help me to get;
1. how to set bits of the status register (0x105)?
2. how to handle conditions to set bit 0 for INJ1 failure and bit 1 for INJ2 failure?

Thank you.

For better code readability, i have attached the codes above.

Labels (1)
0 Kudos
Reply
10 Replies

13,985 Views
uzza9
Contributor III

Dear Jozef,

 

I appreciated your clarification.

One more thing I would like to provide you for the reference is about Status_reg_uc0 registers configuration (on page 4 of the AN4954 doc) as attached file (file name: status_reg_uc0_0x105.jpg) 

 

Thank you and best regards,

Chang.

0 Kudos
Reply

13,987 Views
uzza9
Contributor III

My work for MC33816 mostly refers
    1. sample_code generated by MC33816 Developer Studio IDE.
    2. MicroCode provided with AN4954 MC33816 Diagnostics doc.

According to ProcessAutomaticInterrupts() in MC33816_irq.c of the sample_code, it reads ch1_status_reg_uc0 (the status register at 0x105) and check bit0 if INJ1 fails and check bit1 if INJ2 fails as follows;
    void ProcessAutomaticInterrupts()
    {
        auto_irq = send_single_SPI_Cmd(READ, main_Interrupt_register, 0x00) & 0x000F; // Since this register is latched on first IRQ need to check if other occurred

        ...

        status = send_single_SPI_Cmd(READ, ch1_status_reg_uc0, 0x00); // Read Status register 105h uc0ch1 to check which injector failed
        if ((status & 0x1) == 1) // INJ1 fails b0 at 1
        {...}

        if ((status & 0x2) == 2) // INJ2 fails b0 at 1
        {...}

        ...
    }

And according to Microcode ch1.psc (CH7.1 Injection Banks Management Source Code, page 29) in the AN4954 MC33816 Diagnostics doc, it sets bit5 of the status register with "stsrb" (Set status register bit) instruction. From the code line, I assumed that I might need to set bit 0 e.g. "stsrb high b0" for the fault identification. 
    irq_auto:  stos off off off;              * Disable drivers
                      endiaga diagoff;          * Disable automatic diagnostic
                      stirq low;                        * Set the low IRQB pin
                      stf high BstFlag;            * Set flag0 high DCDC active
                      stsrb high AutoIrqBit;   * Set status register bit 5 when automatic diagnosis interrupt trig


A fault test condition that I got is
    1. to make Source HS1 (it might be INJ1 that I assumed) shorted to GND as described at 5.1.2 (page of AN4954 MC33816 Diagnostics doc.
    2. the fault successfully generates IRQB low (automatic interrupt occurs) and my application (firmware) calls ProcessAutomaticInterrupts function.
    3. I checked that auto_irq = 1 when ProcessAutomaticInterrupts() called by the fault, but the "status" read status register (0x105) is 0 that I think I need to set in the MicroCode.

My understanding from the technical info resources (the sample_code and the doc.) is that I might need to set the status register in MicroCode in MC33816, and so that the status register bit can be read (read only) from application code of MCU.

Please help me how to get the status = 1 when the fault occurs.

For your information, attached you will get.
    1. autoInt_1.jpg file for the fault condition.
    2. ProcessAutomaticInterrupt.jpg for the ProcessAutomaticInterrupts()
    3. microcode_irq_auto.jpg for the original microcode in the AN4954 doc.

0 Kudos
Reply

13,506 Views
JozefKozon
NXP TechSupport
NXP TechSupport

Dear Chang,

I have posted your description to our application team. Unfortunately there is no answer from them. Honestly, this is too complicated for me as I support large portfolio of Analog devices and sensors I am not expert for the MC33816.

However I think the description is also too long for the app. team. Could you please summarize the issue and place a short question for them?

Thank you for your understanding.

With Best Regards,

Jozef

0 Kudos
Reply

13,489 Views
uzza9
Contributor III

Dear Jozef,

Thank you for the update, and please refer to the enclosed summary of questions.

As you pointed the section 6.17.6.1.6 in the MC33816 datasheet, the Status_reg_uc0 (0x105) is read only register. I know that this is MCU's perspective.
Actually, I can set (written) bits of the Status_reg_uc0 register (0x105) using MC33816 microcode instruction e.g. "stsrb high b0".

My original questions were as follows;
    1. how to set bits of the status register (0x105)? ==> This has been solved as mentioned above.
    2. how to handle conditions to set bit 0 for INJ1 failure and bit 1 for INJ2 failure?

Now my updated questions on this issue should be as follows;
    1. how to handle conditions to set bit 0 for INJ1 failure and bit 1 for INJ2 failure?
        a. Does MC33816 automatically check the fault condition if source HS1 shorted to GND? if then which bits of the status register(0x105) match to each fault cases.
        Or
       b. Do I need to set the status bit per fault cases? if then how can I do check the condition prior to setting the status bit high.
            For an instance, how can I make microcode instructions to check condition for fault decision when source HS1 shorted to GND as automatic interrupt event prior to the instruction "stsrb high b0".
    2. As far as I learned from the mc33816 datasheet, the bit (let say bit0) of the status register (0x105) should be cleared once matching bit (bit0) of control register (0x101) written high in MCU application.
        I verified that bit6 (Auto interrupt Status) of the register 0x105 is cleared once bit6 (Auto interrupt Unlock) of the register 0x101 is written high.

        How can I clear the status bit 0 of the register 0x105?

Thank you,

Chang.

Tags (2)
0 Kudos
Reply

13,416 Views
JozefKozon
NXP TechSupport
NXP TechSupport

Dear Chang,

please see below an answer from the application team, I have just received.

DESCRIPTION

1. how to handle conditions to set bit 0 for INJ1 failure and bit 1 for INJ2 failure?
        a. Does MC33816 automatically check the fault condition if source HS1 shorted to GND? if then which bits of the status register(0x105) match to each fault cases. -> This is really depending on how teh microcode is written by customer. In our app note example if a short to GND is detected before injector turn on meaning during idle mode then we set this bit (bit7) in status register 

JozefKozon_0-1728295087845.png


        Or
       b. Do I need to set the status bit per fault cases? if then how can I do check the condition prior to setting the status bit high.

-> You then need to clear this bit by writing a 1 in control register 

JozefKozon_1-1728295088048.png

            
    2. As far as I learned from the mc33816 datasheet, the bit (let say bit0) of the status register (0x105) should be cleared once matching bit (bit0) of control register (0x101) written high in MCU application. -> Correct for the code example we gave
        I verified that bit6 (Auto interrupt Status) of the register 0x105 is cleared once bit6 (Auto interrupt Unlock) of the register 0x101 is written high. -> COrrect

-> This really depend on microcode implementation in our example. To resume operation we lock operation in one of those three loops

JozefKozon_2-1728295087841.png

Meaning that you must write control register (100 or 101) to 1 to unlock operation.

 

If extra support is required we are working with a subcontractor company called Ideas and Motion who can do the microcode for them at a cost of course. They can contact them if need a quote:  Contact alberto.manzone@ideasandmotion.com 

With Best Regards,

Jozef

0 Kudos
Reply

13,996 Views
JozefKozon
NXP TechSupport
NXP TechSupport

Dear Chang,

1. how to set bits of the status register (0x105)?

[A] Please refer to the section 6.17.6.1.6 in the MC33816 datasheet. The Status_reg_uc0 (0x105) is read only register. You cannot write to this register. You can only reset it.

JozefKozon_0-1726812074457.png


2. how to handle conditions to set bit 0 for INJ1 failure and bit 1 for INJ2 failure?

[A] Could you please elaborate which failures you mean? I couldn't find description of "bit 0 for INJ1 failure and bit 1 for INJ2 failure" in the datasheet. 

With Best Regards,

Jozef

0 Kudos
Reply

13,781 Views
uzza9
Contributor III

Hello Jozef,

 

I managed to handle the interrupt that I could set bit 0 of the Status Register in the microcode and then read the error in ProcessAutomaticInterrupts() of my application.

Now I would like to know more detail about the Status Register (0x105).

According to the the docs. (MC33816 Data sheet and AN4954 Application Node), it informs of bit4 ~ bit7 e.g. HoldErrorStatus (bit4), BoostErrorStatus (bit5), and so on.

 

Can you please let me know what the others bits for ?

It is hard for me to get the bits info of (bit00 ~ bit03) and (bit8 ~ bit 15).  

 

Thank you in advance,

Chang.

Tags (2)
0 Kudos
Reply

13,582 Views
JozefKozon
NXP TechSupport
NXP TechSupport

Dear Chang,

I have contacted an application team to answer your questions. They haven't answered me yet. As soon as they answer me, I will definitely reply to you.

Thank you for your patience. 

With Best Regards,

Jozef

0 Kudos
Reply

13,559 Views
uzza9
Contributor III

Hi Jozef,

 

Thank you for the update.

It will be more than great if I get the clarification on my questions from the application team.

 

Best regards,

Chang.  

0 Kudos
Reply

13,892 Views
uzza9
Contributor III

Dear Jozef,

I appreciated your clarification.

My work for MC33816 mostly refers
    1. sample_code generated by MC33816 Developer Studio IDE.
    2. MicroCode provided with AN4954 MC33816 Diagnostics doc.

According to ProcessAutomaticInterrupts() in MC33816_irq.c of the sample_code, it reads ch1_status_reg_uc0 (the status register at 0x105) and check bit0 if INJ1 fails and check bit1 if INJ2 fails as follows;
    void ProcessAutomaticInterrupts()
    {
        auto_irq = send_single_SPI_Cmd(READ, main_Interrupt_register, 0x00) & 0x000F; // Since this register is latched on first IRQ need to check if other occurred

        ...

        status = send_single_SPI_Cmd(READ, ch1_status_reg_uc0, 0x00); // Read Status register 105h uc0ch1 to check which injector failed
        if ((status & 0x1) == 1) // INJ1 fails b0 at 1
        {...}

        if ((status & 0x2) == 2) // INJ2 fails b0 at 1
        {...}

        ...
    }

And according to Microcode ch1.psc (CH7.1 Injection Banks Management Source Code, page 29) in the AN4954 MC33816 Diagnostics doc, it sets bit5 of the status register with "stsrb" (Set status register bit) instruction.
    irq_auto:    stos off off off;             * Disable drivers
                        endiaga diagoff;         * Disable automatic diagnostic
                        stirq low;                       * Set the low IRQB pin
                        stf high BstFlag;           * Set flag0 high DCDC active
                        stsrb high AutoIrqBit;  * Set status register bit 5 when automatic diagnosis interrupt trig


A fault test condition that I got is
    1. to make Source HS1 (it might be INJ1 that I assumed) shorted to GND as described at 5.1.2 (page of AN4954 MC33816 Diagnostics doc.
    2, the fault successfully generates IRQB low (automatic interrupt occurs) and my application (firmware) calls ProcessAutomaticInterrupts function.
    3. I checked that auto_irq = 1 when ProcessAutomaticInterrupts() called by the fault, but the "status" read status register (0x105) is 0 that I think I need to set in the MicroCode.

My understanding from the technical info resources (the sample_code and the doc.) is that I might need to set the status register in MicroCode in MC33816, and so that can be read from appliction code of MCU.

One more thing I would like to provide you for the reference is about Status_reg_uc0 registers configuration (on page 4 of the AN4954 doc) as attached file (file name: status_reg_uc0_0x105.jpg)

Please help me how to get the status = 1 when the fault occurs.

For your information, attached you will get.
    1. autoInt_1.jpg file for the fault condition.
    2. ProcessAutomaticInterrupt.jpg for the ProcessAutomaticInterrupts().
    3. microcode_irq_auto.jpg for the original microcode in the AN4954 doc.
    4. status_reg_uc0_0x105.jpg for Status_reg_uc0 registers configuration.

 

Thank you and best regards,

Chang.

0 Kudos
Reply