DSPRelated.com
Forums

807 SCI1/GPIOD problems

Started by BJ Opp May 7, 2003
I'm trying to setup SCI1 as a communications port (using the
DSP56f807 EVM), but am running into difficulty with it. I have
already setup SCI0 and verified it to be working so I know that i'm
on the right track for sampling data. I have initialized both ports
the same way, 9600 baud, 8 bits, no parity. Also, i have made sure
bits 6-7 on GPIO_D_PER are 1, as they're shared between I/O and
SCI1. Does anyone know if there is something else on the EVM that
could cause problems with SCI port 1? Any help would be greatly
appreciated.

Below is the initialization, and ISR code for SCI1...(mind you, this
exact setup works for SCI0, which is what leads me to believe that
the EVM has something to do with it)... thanks again.

--------------------------
(this is in a DSP_init() routine in main.c)
/* Allow SCI to control bits 6-7 of GPIO_D */
GPIO_D_PER = (D6 | D7);
GPIO_D_DDR = ( D0 | D1 | D2 | D3 | D4 | D5 | D6 );
--------------------------
(the following is in a separate sci module)

PUBLIC void asci_init( void )
{
uint8 dummy_read;

/*
* Keep Interrupts OFF while setting pointers & counters
* (this prevents race conditions)
*/
inptr = in_buffer;
*inptr = NEWLINE; /* end-of-input for
SCI task */

outptr = out_tailptr = out_buffer; /* clear output
pointers */
out_char_cnt = 0;

/*
* The UART is double-buffered, so we need to perform two
* dummy reads to insure that the receiver is cleared
*/
dummy_read = SCI1_SCISR;
dummy_read = SCI1_SCIDR;
dummy_read = SCI1_SCISR;
dummy_read = SCI1_SCIDR;
/*
* configure an interrupt priority level for SCI receive interrupts
* (Note: diagnostic SCI interrupts are VERY LOW priority)
*/
hdw_set_PLR( SCI_1_RX_FULL_VECTOR, CH1 );
/*
* initialize diagnostic port attributes and operating mode
*/
hdw_sci_clr_PE( SCI1 );
hdw_sci_clr_M( SCI1 );

sci_set_admin_baud( baud_9600 );
SCI1_SCICR = ( RIE | TE | RE); // RX IRQs + RX & TX enable
}
--------------------------
(here is the ISR for SCI1)
ISR void admin_sci_isr( void )
{
char c;

status = SCI1_SCISR; // capture status and
SCI1_SCISR = 0; // clear any pending errors

//
// if a character has been received, store it
// otherwise substitute a NUL
//
if (status & RDRF) {
input_char = SCI1_SCIDR;
input_char &= 0xFF;
}
if ((status & OR) || (status & NF) || (status & FE)) {
input_char = NUL;
}
}