AnsweredAssumed Answered

Terminal output working, but not input

Question asked by dyspn on May 29, 2015
Latest reply on Jun 4, 2015 by dyspn



On my board using the MCF52230 I'm using the QSPI's tertiary function as URXD1/UTXD1. I've made sure to change all the settings to set it to the right UART port and stuff. I can call printf() and it will appear in my terminal. The problem is when I call scanf() it hangs and waits for input, but I type a string and hit enter and I don't receive anything back. Really confused why it isn't working, so any help would be beneficial.


Here's what the code looks like.

char str[64] = "Test";   MCF_GPIO_PQSPAR = 0x0F; //Set QSPI to tertiary function URXD1/UTDX1 #if (CONSOLE_IO_SUPPORT || ENABLE_UART_SUPPORT)      printf("Enter stuff: "); //Appears in terminal      scanf(" %s",str); //Then nothing happens when I enter a string (can't see what I'm typing unless I have echo on)      printf("You entered %s",str); //Never get to this point, since I'm apparently not receiving anything  


I've tried the same thing with uart_putchar, and uart_getchar. Same thing happens. uart_putchar will work, but I won't get anything back when entering a char with uart_getchar.


It loops like the code is getting stuck on this loop in uart_getchar, and me inputting stuff into the terminal isn't letting me get out of it.

char uart_getchar (int channel) {    /* Wait until character has been received */     while (!(MCF_UART_USR(channel) & MCF_UART_USR_RXRDY))      {         //Getting stuck in this loop!     };     return (char)MCF_UART_URB(channel); }