I'm attempting to get serial mode 0 communications working using the CY3684 demo board (CY7C68013A).
The TRM indicates (14.3.3 pg 203 table 14-11 for SCON0.1) that once a byte is successfully transmitted, the USART0 interrupt is triggered and the TI_0 bit (bit 1) in the SCON0 SFR is set.
My problem is that, while I do see the interrupt happing, the TI_0 bit doesn't appear to be set.
I'm using the Keil C51 c compiler and the framework provided by Cypress. Below are the bits of code I think are relevant.
Setting up for serial communication:
// Port E setup
PORTECFG = 0x28; // Enable RXD0OUT and INT6 for serial coms, all other alternate functions disabled (TRM 13.4.4)
OEE = 0x08; // Set port RXD0OUT to output, all others inputs
// Serial coms on serial port 0 setup (TRM 14.3.3)
SCON0 = 0x00; // Mode 0, baud CLKOUT/12
EICON &= 0xF7;
g_is_tx = FALSE;
IE |= bmBIT4; // Enable recieve and transmit interrupts
EIE |= bmBIT4; // Enable INT6 interrupt (used for FPGA to signal data to tx)
EICON &= 0xF7;
EA = 1;
The byte to be sent is provided by a vendor request over EP0.
BOOL DR_VendorCmnd(void)
{
switch (SETUPDAT[1])
{
case CMD_SEND_BYTE:
SBUF0 = SETUPDAT[2];
g_is_tx = TRUE;
EP0CS |= bmHSNAK;
break;
}
return(FALSE);
}
The USART0 ISR. It turns on LED2 when called, and conditionally turns on LED3 and LED4 based on the TI_0 and RI_0 interrupt flags. LED2 does turn on, but LED3 and LED4 don't.
void ISR_USART0(void) interrupt 4
{
unsigned char temp;
temp = LED2ON;
if (SCON0 & 0x01 > 0)
temp = LED3ON;
if (SCON0 & 0x02 > 0)
temp = LED4ON;
}
I feel like I'm missing something basic, but just haven't been able to figure it out. Any help would be very appreciated.
|