Hi, Ryan, Thank you so much for your reply.
I am using a SCLK boud rate of 480.5kHz and the default data rate of ADS1299 EEG-FE is 250 SPS, is the SCLK too slow?
JP21,JP22,JP23 are all connected by 1-2 as factory default. I am probing /CS from pin 7 of J3, /DOUT from pin 13 of J3, and SCLK from pin 3 of J3. When I use MMB0 to communicate with ADS1299 EEG-FE, I can get correct signals using the ADS1299 EEG-FE software, so I think the jumper and signal are configured correctly.
I am thinking there might be some errors in my SPI read program. Will you please take some time to have a look at it? Thank you.
while (DRDY == 0)
{
// Clear SSN, the SPI slave is active when SSN is low.
CS = CS_ENABLED;
int i;
for (i = 0; i< 27; i++) //27 bytes to read
{
// Clear transmit byte status.
U1CSR &= ~0x02;
// Write dummy byte to USART1 buffer to trigger SCLK.
U1DBUF = dummyByte;
// Check if byte is transmitted (and a byte is recieved).
while(!(U1CSR & 0x02));
// Write received byte to buffer.
rxBufferMaster[i] = U1DBUF;
}
// Set SSN, the SPI slave is inactive when SSN is high.
CS = CS_DISABLED;
}
BTW, how can I read and write registers of ADS1299? For example, if I want to send the command SDATAC to stop the RDATAC mode and change the data rate in CONFIG1 register to 1000 SPS, should I just write 0x11(SDATAC) to the buffer? Is the code below right?
while(1)
{
CS = CS_ENABLED;
U1CSR &= ~0x02; // Clear transmit byte status.
U1DBUF = 0x11; // Write SDATAC(11h) to stop RDATAC mode.
while(!(U1CSR & 0x02)); // Check if byte is transmitted (and a byte is recieved).
// write CONFIG1 to change date rate to 500 SPS.
U1CSR &= ~0x02;
U1DBUF = 0x41; // WREG Opcode 1---- CONFIG1 address: 01H
while(!(U1CSR & 0x02));
U1CSR &= ~0x02;
U1DBUF = 0x00; // WREG Opcode 2---- No. of register: 1
while(!(U1CSR & 0x02));
U1CSR &= ~0x02;
U1DBUF = 0x94; // Data rate of 1000 SPS
while(!(U1CSR & 0x02));
CS = CS_DISABLED;
}