i'm having problems reading data from the MAX3420e on my SPI receive buffer UCB3RXBUF. What is weird is I have all the signals on a 4-channel scope and I see the command byte transmitted followed by the data. I also see on the MISO (Rx line) the data I just transmitted. But the UCB3RXBUF always shows zero. Chip select is controlled by another port pin, not STE
Here is my read routine... any ideas appreciated.
////////////////////////////////////////////////////////////////////////////////
#define DIR_READ 0 //Bit1 clr is read bit static uc max3420_rreg(uc regAddr)
// Function:
//
// Read a register, return its value.
//
////////////////////////////////////////////////////////////////////////////////
{
volatile uc dummy = 0;
ChipSelectLow_SS(); // enable 3420 chip - not part of SPI, controlling with another port
SpiUartB3_TxBuffer() = (regAddr + DIR_READ); // store 3420 register address and set direction - UCB3TXBUF reg
while(SpiUartB3_StatusReg() & UCBUSY); // check UCB3STAT reg
dummy = SpiUartB3_RxBuffer(); // Needed to re-enable the input buffer in BYTE mode - UCB3RXBUF reg
SpiUartB3_TxBuffer() = (0x00); // dummy write - UCB3TXBUF reg
while(SpiUartB3_StatusReg() & UCBUSY); // check UCB3STAT reg
while (!(SpiUartB3_IRQflagReg() & UCRXIFG)) ;// while interrupt - UCB3IFG reg
ChipSelectHigh_SS(); // disable 3420 chip - not part of SPI, controlling with another port
return(SpiUartB3_RxBuffer()); // UCB3RXBUF show zero!!!!!
}
please help me shed some light on this. I'm running the clock using the FLL+ at 12 Mhz and dividing baud rate to 2Mhz.
Thanks, Jim