Problem with the KBI of the MPXY8300 TPMS kit

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

Problem with the KBI of the MPXY8300 TPMS kit

1,134 Views
riccardocescato
Contributor I

Hi,

I have a problem with the generation of a KBI on the TX module of the mpxy8300 kit.

The TPMS has a microprocessor of the HCS08 family.

I followed the instructions in the kit manual writing this code:

main()

...

   PTADD=0x00;    //configure pins as input

   KBISC=0x00;    //KBI disable

   KBIES=0x00;    //select falling edge/low level

   PTAPE=0x2C;    //configure pullup(1)/pulldown(0)

   KBIPE=0x2C;    //enable PTA2-3-5 as KBI

   KBISC=0x04;    //clear KBF

   KBISC=0x02;    //enable KBI and set edges-only detection mode

for(;;);     //infinite loop to test the KBI

the interrupt function associated to the KBI is:

void interrupt USER_15_INTERRUPT(void)

{

    KBISC_KBACK=1;  // clear ACK

   //then  I put a function that send something to the RX module

}

In this way I see that the PTA pins are connected correctly to ground using an internal pulldown resistance as described in the datasheet.

My problem is that when I connect the PTA pin to ground using a wire, KBI is not called and the module doesn't send anything.

Has anyone the same problem??

thank you!

0 Kudos
9 Replies

815 Views
iansmusical
Contributor V

Hello Riccardo,

I'll start by stating the obvious but have you enabled global interrupts?

I think you also have to enable the KBIE bit in the KBISC register. It looks like you currently have the KBI interrupt request disabled?

Thanks,

Ian

0 Kudos

815 Views
riccardocescato
Contributor I

yes, at the beginning of the main there is the macro:

EnableInterrupts;

I started from the code that there was in the kit and this macro was already written.

In the datasheet I read there is a global mask for interrupt that is the first bit of the CCR (Condition code register) and it has to be set to 0 to enable interrupt.

I think this macro has this rule, because I didn't find any function to write on that register.

The KBIE bit is enabled with the last statement -> KBISC=0x02;

Before it was clear to avoid false interrupts.

Other interrupts work so I don't understand what is the problem.

Thanks,

Riccardo

0 Kudos

815 Views
iansmusical
Contributor V

Hi Riccardo,

Yes the EnableInterrupts macro takes care of the global mask, so that can be ruled out now.

Are all the selected KBI pins using a pull up resistor (and externally high) and the others disabled? Is the KBI interrupt defined in the vector table? I don't think you need the PTA* lines. You might need to set KBIMOD in the KBISC register?

You could check HCS08QRUG.PDF document which gives examples of using the S08 peripherals.

Thanks,

Ian

0 Kudos

815 Views
riccardocescato
Contributor I

with the instruction:

PTAPE=0x2C;

I configure the pullup for the pin PTA 5-3-2, the others are disabled.


The KBI interrupt is the numer 15 in the interrupt vector table and it is defined. In fact I put the function that sends me something in this routine.


KBIMOD in the KBISC register is set using this line:

KBISC=0x04;

I put it at 0 to select only the edges, but I tried also with the KBIMOD at 1 and the result is the same.


I have already read this PDF, I will check again.


Thanks,

Riccardo



0 Kudos

815 Views
iansmusical
Contributor V

Hi Riccardo,

Hmm! It seems like you are setting everything up correctly. Might be worth checking other implementations to see if you have missed something? App notes AN2900, AN4875, http://cache.freescale.com/files/microcontrollers/doc/user_guide/QE128QRUG.pdf?&Parent_nodeId=&Paren... and any errata for your device.

Thanks,

Ian

0 Kudos

815 Views
riccardocescato
Contributor I

I checked everything, I used a loop in which I send some data if the register is set correctly and I discovered that the problem is the KBI FLAG.

What I have is this:

     PTA2 pin is connected with a pullup and I measure 3V correctly.

     Pins are sensitive to a falling edge.

     The pin is enabled as KBI as also the KBIE pin is enabled.

     When I connect the PTA2 pin to ground, reading PTAD register I see this and all work correctly.

     The KBF is never set.

If I read the KBISC_KBF bit, I read always 0.

In the datasheet there are no explanations on how it is set and nothing about the SINCHRONIZER block there is in the scheme of the KBI.

And also I can't force the KBF to 1.

What can I do?

thanks,

Riccardo

0 Kudos

815 Views
iansmusical
Contributor V

Hi Riccardo,

The behaviour is very odd!! Are there any system options registers that control the clock to the KBI module? Can you post the reference manual as I can't find it on the Freescale website?

Thanks,

Ian

0 Kudos

815 Views
riccardocescato
Contributor I

I checked also this but it seems that the clock is always enabled to the KBI module.

You can find the reference manual of the HCS08 that is the processor of the TX module of the MPXY8300 kit on this link:

http://cache.freescale.com/files/microcontrollers/doc/ref_manual/HCS08RMV1.pdf

0 Kudos

815 Views
iansmusical
Contributor V

Hi Riccardo,

Sadly the reference manual was not really of use for the KBI related information.

Unless someone from Freescale can give the magic answer you need then it's probably time to start testing the software on another S08 chip (if you have one!). This would indicate if the MPXY8300 hardware is faulty or if the software doesn't work on a different S08, that the software is wrong.

Otherwise I am running out of suggestions to make :-(

Thanks,

Ian

0 Kudos