Hi all
I have a MSP430FR5994 Launchpad and am integrating a DS1620+ temperature sensor from Maxim Integrated. I am currently bit banging (doesn't support I2C or SPI without extra hardware) to initialise the sensor to continuously convert, and then writing the 'read temperature' command in an endless loop. I am toggling a pin to check the speed on an oscilloscope. When writing the 'read' command alone, this occurs at a rate of 40kHz. When I actually store the data, this drops to 10KHz, when I expected it to reach ~20kHz (writing an 8 bit command, reading 9 bit data). Does anyone know why this may be the case? Speed is a critical factor for this project, so I need to make this as fast as possible.
I have noted that the datasheet for the sensor states that the maximum clock frequency is 1.75MHz, could this possibly a factor (Although I wouldn't have thought so since I don't reach these speeds)?
Additionally, I have set the main clock to 8MHz, but when I double this to 16MHz, the speed approximately halves (to below 5kHz when storing data). I cannot understand why this is the case, as this also happens when using an SD card in another program. I have noted that FRAM can only operate at a maximum speed of 8MHz, could something similar be happening in these cases?
I've attached the endless loop, with data storage, below.
while (1){ //------Start talking------// P4OUT = 0x08; //CLK high P2OUT = 0x20; // Active on RST high // Send 'read temp' command (0b 1010 1010, LSB first) P4OUT = 0x08; P4OUT = 0x00; P4OUT = 0x08; P4OUT = 0x0C; P4OUT = 0x04; P4OUT = 0x0C; P4OUT = 0x08; P4OUT = 0x00; P4OUT = 0x08; P4OUT = 0x0C; P4OUT = 0x04; P4OUT = 0x0C; P4OUT = 0x08; P4OUT = 0x00; P4OUT = 0x08; P4OUT = 0x0C; P4OUT = 0x04; P4OUT = 0x0C; P4OUT = 0x08; P4OUT = 0x00; P4OUT = 0x08; P4OUT = 0x0C; P4OUT = 0x04; P4OUT = 0x0C; //------Start reading------// P4DIR = 0x08; // Set P4.2 (DQ) as an input // Collect bits for(n=0;n<9;n++){ P4OUT = P4IN & 0xF7; int status = P4IN & 0x04; if (status == 0x04){ rawData[n] = 1; } if (status == 0x00){ rawData[n] = 0; } P4OUT = P4IN | 0x08; } P4DIR = 0x0C; // Set P4.2 (DQ) as an output P2OUT = 0x00; // RST low //------Stop talking------// P8OUT ^= 0x02; // toggle oscilloscope pin }