Quantcast
Channel: Forums - Recent Threads
Viewing all articles
Browse latest Browse all 262198

Can't receive data with uart0

$
0
0

Hello @ All

I am using LM3S8938 and an interface IC (max232) to communicate  with the Hyperterminal on my PC. I can send Data to the hyerterminal but I can't receive any data.I've disconnect the board form PC and made a loop that connect pin 2 and pin 3 in the D9 (serial Port -Board side)but I still can't receive what I have sent. This is my code

void main(void)

{

    //
    // Set the clocking to run directly from the crystal.
    //
    SysCtlClockSet(SYSCTL_SYSDIV_1 | SYSCTL_USE_OSC | SYSCTL_OSC_MAIN |
                 SYSCTL_XTAL_8MHZ);
   
   
   
    //
    // Enable the peripherals used by this program code.
    //

    SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0);

 
    SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
   
    GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1);

    GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_2);
    //
    //    Initialze the UART. Set the baud rate , number of data bits, turn off
    //    parity, number of stop bits, and stick mode
    //  
   
    UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200,
                        (UART_CONFIG_WLEN_8 | UART_CONFIG_STOP_ONE |
                         UART_CONFIG_PAR_NONE));
   
   
  
  
 
    //
    // Enable the UART.
    //
    UARTEnable(UART0_BASE);
   
    //Send a Char
   
     UARTCharPut(UART0_BASE, '1');
 

 
    
  
if(UARTCharsAvail(UART0_BASE) == true )
          {
         
       
           GPIOPinWrite(GPIO_PORTA_BASE,GPIO_PIN_2, GPIO_PIN_2);
          
         }
    
     UARTDisable(UART0_BASE);
   while(1)
   {  
    
   }

}

thanks

Bassel


Viewing all articles
Browse latest Browse all 262198

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>