This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

enable interrupts in UART0 and RTC lp2136

Hello everyone,

I am trying to use the following peripherals in my application: UART0, SPI0, I2C0 and RTC

For some reason when I enable the interruption of the serial port the other peripherals do not work correctly:
Confirm that the initialization and enablement of all peripherals are correct:

void uart_init(void)				//9600 BAUD		pclock 48MHZ
{
 PINSEL0 |=0x00000005;			
 //U0FCR=0x07;					//enable FIFO	
 U0LCR=0X83;            //8-data bits, 1 Stop bit, Disable Parity and Enable DLAB
 U0DLL=0x38;							//	MULVAL = 0x5 and DIVADDVAL = 14
 U0DLM=1;
 //U0FDR= 0x00000010;			//	MULVAL = 1 and DIVADDVAL = 0
 U0LCR=0X03;            //cleared DLAB
 U0IER= 0x00000001;									//Interrupt
}

void UART0_Interrupt_EN(void)
{
	VICIntSelect = 0x00000000; 
	VICVectAddr6 = (unsigned) UART0Handler;				//Vector 
	VICVectCntl6 = 0x00000020 | 6; 						//select UART0 interrupt as IRQ i.e vector 6
	VICIntEnable |=(1UL<<6);									
}
//-----------------------------------------------------------------
void init_RTC(char *time)
{
	//PREINT  = (int)(PCLK/32768)-1
	//PREFRAC = PCLK - ((PREINT+1)*32768
	PCONP = (PCONP | (1<<9)); /* PCRTC = 1 */
	PREINT = 0x5B7;
	PREFRAC = 0x6c00;
	CIIR = 0x03; /* Minutes value increment interrupt */
	CCR = 0x1;     //Start the RTC
	//ILR = 0x01; /* RTC interrupts enabled */
}

void RTC_Interrupt_EN(void)
{
	VICIntSelect = 0x00000000; 
	VICVectAddr13 = (unsigned) read_rtc;				//Vector 
	VICVectCntl13 = (1UL<<5)  | 13;					//select RTC interrupt as IRQ i.e vector 13
	VICIntEnable |=(1UL<<13);										
}
//-----------------------------------------------------------------
void I2C_Init (void) //pclock 48MHZ
{
	// Power on I2C0 peripheral
	PCONP	|= 0x00000080;
	
	// Define port pin as SDA and SCL
	PINSEL0	|= 0x00000050 ;

	I2C0CONCLR	= 0x6C;	// clear all I2C config bits
	I2C0CONSET	= 0x40;	// set I2EN
	
	// I2C Clock Duty Cycle (high and low)	
	I2C0SCLH 	= PERIFERAL_OPERATING_FREQUENCY_IN_HZ/(2*EEPROM_OPERATING_FREQUENCY_IN_HZ);
	I2C0SCLL 	= PERIFERAL_OPERATING_FREQUENCY_IN_HZ/(2*EEPROM_OPERATING_FREQUENCY_IN_HZ);
}

//----------------------------------------------------------------

void SPI_init(void)
{
	
	PINSEL0 |=0x1500;			
	S0SPCCR=0x8;		//pclock 48MHZ ---> 48khz
	S0SPCR=0x0824;		//Master
}