first of all i want some sample codes to work with c5515 of all pheripherals dont show me the way to chip support libarary i can learn nothing from them
here my question is my problem to do basic uart communication using 100Mhz-clk,9600 baud,1start,1stop,noparity ,8data in non fifo mode
here is my code:
uart.c
----------------------------------
/*
* uart_fun.c
*
* Created on: Mar 28, 2013
* Author: shyam
*/
#include<uart_fun.h>
#include<stdio.h>
void uart_init(void);
/*
* involves intialisation of uart setting pll to 100Mhz and selection of 9600 baud
*/
char uart_read(void);
/*
* invloves reading a character through uart and return to called function
*/
void uart_write(char);
/*
* involves writing a character through uart
*/
void uart_wstring(char*);
/*
* involves writing a string through uart possibly adress of string is sent
*/
void uart_init(void)
{
int i;
//setting PLL to 100Mhz
// bypass PLL
CONFIG_MSW = 0x0;
PLL_CNTL2 = 0x8000;
PLL_CNTL4 = 0x0000;
PLL_CNTL3 = 0x0806;
PLL_CNTL1 = 0x8BE8; //PG1.4: 0x82FA;
////// ( (PLL_CNTL3 & 0x0008) == 0);
for(i = 0 ; i < 5000; i++);
// Switch to PLL clk
CONFIG_MSW = 0x1;
//Pin multiplexing by EBSR
EBSR|=0x1a3f;
//Enable uart clock in pcgcr1
PCGCR1&=(~(1<<2));
//Putting UART Tx and Rx Reset through PWREMU_MGMT
PWREMU_MGMT=0X7FFF;
//selecting baud by writing app divisor in DLL DLH
//9600 Baud at 100Mhz clock value to be loaded is 28B
DLL|=0X008b;
DLH|=0X0002;
//choosing FIFO or non-FIFO mode
FCR=0X0000;//non fifo
//Configure LCR for start,stop,non parity,8 data bits
LCR=0X0003;
//ENABLE INTERRUPTS
IER=0X0002;
//DONE
printf("UART Initialization Done");
}
char uart_read(void)
{
char byte_read=0;
while(!(1&LSR));//WAIT FOR DATA TO BE READY
return(byte_read=RBR);
}
void uart_write(char byte2write)
{
while(!(1&(LSR>>5)));//wait until buffer is empty
THR=byte2write;
}
----------------------------------------------------------------------
main.c
------------------------------------------------------------------------------
void main(void)
{
uart_init();
while(1)
{
uart_write(uart_read());
}
}
----------------------------------------------------------------------------
problem:
not able to do possible UART communication,i am able to read from uart but not able to write back,thus i am not able to see the echo of characters on serial terminal
confusions:
i am aware of 8051 in which transmission interrupt specifies completion of transmission later we clear it ,in above case how can i do it in c5515 processor
and during Rx ,Rx interrrupt flag is set and further we clear and take data in buffer ,how can that could be done in c5515 processor
so for these confusions i have been asking some sample codes from TI,this is a serious problem ,your CSL dont say a learner whats happening with processor just writing a function call cant solve the quench of a beginner try to identify this need of begineers and do the need
thank you