Hi all,
I have an external peripheral which is connected to port D3.
I set this port as interruptable.
My problem is that the interrupt is called only on falling edge. The pdf doesn't mention any thing about falling edge only.
This is my init sequence:
PTDSC_PTDIE = 0; | //first disable interrupt | |
PTDPS_PTDPS3 = 1; //Enable the interrupt pin | ||
PTDSC_PTDACK = 1; //Clear any false interrupts | ||
PTDSC_PTDIE = 1; //enable interrupts | ||
PTDDD_PTDDD3 = 0; //input | ||
Thanks. |
Hello,
Add the following to your initialisation code -
PTDES_PTDES3 = 1; // Interrupt on positive edge.
Also be aware that, if enabled, there will be an internal pull-down, rather than pull-up, for the pin. This may not suit all situations. If a pull-up is required, this would need to be an external resistor.
Regards,
Mac
Hello bigmac,
I tried your solution but still doesn't work even combined with David solution.
I base my assumption that rising edge is not support also by device expert which states that none of the GPIOs ports supports
rising edge not only by not getting interrupt.
Hello,
eran yasso wrote:
I base my assumption that rising edge is not support also by device expert which states that none of the GPIOs ports supports
rising edge not only by not getting interrupt.
I refer you to section 6.3 Pin Interrupts, within the 'DZ60 datasheet. Fig. 6.2 clearly shows that edge selection is provided.
There could be other reasons why interrupts are not occurring, e.g. not having the correct vector address associated with the ISR. As mentioned previously, there can be hardware incompatibility with the external peripheral device, especially if it provides an "open-drain" output. In this case you would need to disable the internal pull-down, and provide a suitable external pull-up resistor, for interrupts to work on the positive edge.
Regards,
Mac
I couldn't find the reference manual for this part, but I use the MC9S08LL8. Do you have a
"Interrupt Pin Request Status and Control Register" (IRQSC). If so, try setting
IRQMOD (bit 0) to 1 to allow interrupts on falling and rising edges.
Hello David,
I tried your solution but still doesn't work.