prabakaran.s
Newbie level 3
Hi I'm using ENC28j60 Chip. i communicate this chip Via MSP430F2272 controller ( SPI protocol).But i can't read the ENC28j60 Registers.
My write Code:
P3OUT &= ~ETH_CS; //Pull the STE low
while(!(UCB0IFG & ETH_TXIFG)); //Wait to make a transmission
UCB0TXBUF = u8ETHRegAddr; //Transmit address
while(!(UCB0IFG & ETH_TXIFG)); //Wait to make a transmission
UCB0TXBUF = pu8spiETHTxData; //Transmit data
while(!(UCB0IFG & ETH_TXIFG)); //Wait to make a transmission
P3OUT |= ETH_CS; //Pull the STE high
My Read Code:
P3OUT &= ~ETH_CS;
u8ETHRegAddr &= 0x3F; //Reset MSB for Read operation
while(!(UCB0IFG & ETH_TXIFG)); //Wait to make a transmission
UCB0TXBUF = u8ETHRegAddr; //Transmit data to configuratiuon register
while(!(UCB0IFG & ETH_TXIFG)); //Wait to make a transmission
for(u8delay = 0; u8delay < 15; u8delay++);
for(u8index = 0; u8index < u8ETHRxDataLen; u8index++)
{
// UCB0TXBUF = 0x00; //Transmit dummy data
// while(!(UCB0IFG & ETH_TXIFG)); //Wait to make a transmission
gau8ETHRxBuf = UCB0RXBUF; //copy data from SPI Rx buffer
while(!(UCB0IFG & ETH_RXIFG)); //Wait to receive a data
gau8ETHRxBuf = UCB0RXBUF; //copy data from SPI Rx buffer
I have problem in reading the register.
Thank
My write Code:
P3OUT &= ~ETH_CS; //Pull the STE low
while(!(UCB0IFG & ETH_TXIFG)); //Wait to make a transmission
UCB0TXBUF = u8ETHRegAddr; //Transmit address
while(!(UCB0IFG & ETH_TXIFG)); //Wait to make a transmission
UCB0TXBUF = pu8spiETHTxData; //Transmit data
while(!(UCB0IFG & ETH_TXIFG)); //Wait to make a transmission
P3OUT |= ETH_CS; //Pull the STE high
My Read Code:
P3OUT &= ~ETH_CS;
u8ETHRegAddr &= 0x3F; //Reset MSB for Read operation
while(!(UCB0IFG & ETH_TXIFG)); //Wait to make a transmission
UCB0TXBUF = u8ETHRegAddr; //Transmit data to configuratiuon register
while(!(UCB0IFG & ETH_TXIFG)); //Wait to make a transmission
for(u8delay = 0; u8delay < 15; u8delay++);
for(u8index = 0; u8index < u8ETHRxDataLen; u8index++)
{
// UCB0TXBUF = 0x00; //Transmit dummy data
// while(!(UCB0IFG & ETH_TXIFG)); //Wait to make a transmission
gau8ETHRxBuf = UCB0RXBUF; //copy data from SPI Rx buffer
while(!(UCB0IFG & ETH_RXIFG)); //Wait to receive a data
gau8ETHRxBuf = UCB0RXBUF; //copy data from SPI Rx buffer
I have problem in reading the register.
Thank