Hi All,
I am hoping someone can help me to figure out why I can not seem to get a SCLK signal out of my RCM6710 on TXD. I am sure it is something stupid I am doing as I have had no problems in the past using TXB
I am using PD0 as TXD. PC0 as MOSI & PC1 as MISO and am letting the SPI.LIB do the heavy lifting. I can see the data when using thew SPIWrite function but I do not see the clock on PD0.
It must be that I am not telling the Rabbit to put the SCLK out on pin PD0!
Here is my code:
#class auto
/************* SPI Setup ***********************************************/
#define SPI_MASTER
#define SPI_SER_D
#define SPI_CLK_DIVISOR 50
#define CLOCK_PORT D
#define SPI_RX_PORT SPI_RX_PC
#define CLOCK_BIT 0
#define SPI_CLOCK_MODE 0
#define SPI_DEBUG
#use “spi.lib”
#define ADC_CS_T BitWrPortI(PEDR, &PEDRShadow, 0, 7)
#define ADC_CS_F BitWrPortI(PEDR, &PEDRShadow, 1, 7)
#memmap xmem
#use rcm67xx.lib
void main()
{
int Result;
unsigned short Data;
brdInit();
WrPortI(SPCR,NULL,0x80); // set A as an input
WrPortI(PBDDR, &PBDDRShadow, 0xfd); // 0,2,3,4,5,6,7 outputs.
WrPortI(PBDR, &PBDRShadow, 0x80); // set all to zero except PB7 (be carefull PB0 is for flash)
BitWrPortI(PCFR,&PCFRShadow,1,0); // Needed SPI_SER_D sets Bit 0 (TXD) to alternate function
WrPortI(PCDDR, &PCDDRShadow, 0x55); //(inputs= PC1 PC3,PC5,PC7. Outputs=PC0,PC2,PC4,PC6
WrPortI(PCDR, &PCDRShadow, 0x00);
WrPortI(PDDDR, &PDDDRShadow, 0xfd); // All outputs except PD1
WrPortI (PEDDR, &PEDDRShadow, 0xff); // set E as output
WrPortI (PEDCR, &PEDCRShadow, 0x00); //Normal output
WrPortI (PEFR, &PEFRShadow, 0x00);
WrPortI(PEDR, &PEDRShadow, 0x80); // be careful with PE4 it not assignable on rcm6700
SPIinit();
Data= 0x7f7f;
ADC_CS_T;
Result = SPIWrite(&Data,2);
ADC_CS_F;
printf(“Result = %x\\n”,Result);
} //End of main
Thanks in advance
Terry