Other Parts Discussed in Thread: CC2541, ADS1299
Hello,
1. I am trying to use CC2541 to send register read command to ADS1299, but it seems i can't read the register data back correctly.
Could someone help to check my code please?
What could be the reason?
void ads1299_read_reg(uint8 ADR, uint8 *register_data)
{
CS_ADS = 0;
spiWriteByte(_RREG|ADR);
us_delay(5);
spiWriteByte(0x00);
us_delay(5);
spiReadByte(register_data, 0xFF);
us_delay(5);
CS_ADS = 1;
}
void spiReadByte(uint8 *read, uint8 write)
{
U0CSR &= ~0x02; // Clear TX_BYTE
U0DBUF = write;
while (!(U0CSR & 0x02)); // Wait for TX_BYTE to be set
*read = U0DBUF;
}
void spiWriteByte(uint8 write)
{
U0CSR &= ~0x02; // Clear TX_BYTE
U0DBUF = write;
while (!(U0CSR & 0x02)); // Wait for TX_BYTE to be set
}
2. Another question is every time after i set the START pin to high, even the ADS is not powered up, i still could read data from ADS on SPI, Is this normal?
The reason i ask this question is i can't find out what kind of data i will be reading in this way.
Thanks a lot.