Home > other >  OMAPL 138 serial port to send the interrupt problem
OMAPL 138 serial port to send the interrupt problem

Time:10-18

This is a routine for the company, bosses, help to have a look at the trouble to send interrupt? Development manual on serial port to send interrupts have two conditions, one is to make the FIFO, 2 it is to send keep register is empty, I according to the program to change the program can only receive data, all meet the trigger condition, but can not take the initiative to send data, show the following
# include "TL138. H"//"dragon TL138 development board related statement

# include "hw_types. H"//macros
# include "hw_syscfg0_OMAPL138. H/module/system configuration register
# include "soc_OMAPL138. H"//OMAPL138 peripheral registers

# include "PSC. H"//power abstraction layer of sleep macro control and equipment function declaration
# include "gpio. H"/macros and general input/output device abstraction layer function declaration
# include "uart. H"//universal asynchronous serial port macros and equipment abstraction layer function declaration
# include "interrupt. H"//OMAPL138 interruption related application interface function declaration and definition system event number

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* */
a macro definition/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
//the clock
# define SYSCLK_1_FREQ (456000000)
# define SYSCLK_2_FREQ (SYSCLK_1_FREQ/2)
# define UART_2_FREQ (SYSCLK_2_FREQ)

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* global variables */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Char txArray []="Tronlong UART2 Application... \ n \ r ";

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
Function declaration/* */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
//peripherals can make configuration
Void PSCInit (void);

//GPIO pin reuse configuration
Void GPIOBankPinMuxSet ();

//UART initialization
Void UARTInit (void);
//ARM interrupt initialization
Void InterruptInit (void);
//initialize the UART interrupt
Void UARTInterruptInit ();
//UART interrupt service function
Void UARTIsr (void);

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* the main function */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Int main (void)
{
//peripherals can make configuration
PSCInit ();

//GPIO pin reuse configuration
GPIOBankPinMuxSet ();

//ARM interrupt initialization
InterruptInit ();

//UART initialization
UARTInit ();

//initialize the UART interrupt
UARTInterruptInit ();

//the main loop
For (;; )
{

}
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* the PSC initialization */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Void PSCInit (void)
{
//make for corresponding peripheral modules can also can be done in the BootLoader
//can make UART2 module
PSCModuleControl (SOC_PSC_1_REGS HW_PSC_UART2, PSC_POWERDOMAIN_ALWAYS_ON PSC_MDCTL_NEXT_ENABLE);
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* GPIO pin reuse configuration */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Void GPIOBankPinMuxSet (void)
{
//UART2 disable flow control
UARTPinMuxSetup (2, FALSE);
}

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* */
/* ARM interrupt initialization */
/* */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
Void InterruptInit (void)
{
//initialize the ARM interrupt controller
IntAINTCInit ();

//can make IRQ (CPSR)
IntMasterIRQEnable ();

//the interrupt (AINTC GER)
IntGlobalEnable ();

//the interrupt (AINTC HIER)
IntIRQEnable ();
}

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related