Report
9 months ago.

Serial connection on FRDM-KL25Z with Interrupt doesn't work

Serial connection on FRDM-KL25Z with Interrupt doesn't work. Particularly printf function does not work after I use interrupts with Ticker, InterruptIn. The small part of the program is:

  1. include "mbed.h"

Ticker tick;

Serial pc(USBTX, USBRX); tx, rx

volatile int y=1;

void change(void){ y*=2; }

int main() {

InterruptIn iins(PTA2); iins.rise(&fn);

tick.attach(&change, 3.0);

while(1) { pc.printf("%d!\n",y); wait(1); }

Comment on this question

1 Answer

8 months, 3 weeks ago.

Hi Priyanshu,

We have tested your program and it looks like you had some bad luck selecting the pins for your InterruptIn. It just so happens that PTA2 is used for the USBTX pin which explains why the printf() is not working. Please see:

If you change the pin to something other than PTA1 or PTA2 (such as PTD4) then you should see things work:

InterruptIn iins(PTD4);

Regards,

Ralph, Team Mbed


You need to log in to post a question