Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
6 years, 1 month 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:
- 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); }
1 Answer
6 years 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