I'm trying to use one of the USARTs in the Meag644P as an SPI master to read data from a MAX31855 Thermocouple-to-digital converter. It has Only ChipSelect, Clock, and Data Out connections.
Below are my register settings
// PB0 = XCK0 - Output // PD1 = TXD0 - Output // PD0 = RXD0 - Input UBRR0 = 0; // Allows 1Mbps at 16MHz clock. DDRB |= (1<<DDB0); //XCK0 as output UCSR0C = ((1
The problem is, the clock never stops. It just keeps running. There was another post here about a 2313A with a clock that was always running, but he wasn't setting both UMSELnX bits.
Reading data via:
for (uint8_t n=0; n<4; n++) { while( !( UCSR0A & (1<<UDRE0)) ); UDR0 = 0;// send a null byte while( !(UCSR0A & (1<<TXC0)) );// wait until transfer ends thermodata = (thermodata<<8) + UDR0; }
Normal SPI works great and I can read data with no issues.
Am I missing something here? Is the disconnected TXD0 line causing some sort of issue? Why does the clock just keep running?
Thanks.