This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430FR5994: Increasing read speed from a DS1620+ temperature sensor

Part Number: MSP430FR5994

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
    }

  • I forgot to mention, I have the sensor connected as follows:

    P2.5 - RST
    P4.3 - CLK
    P4.2 - DQ
  • Hi JSud,
    Where do you save the data? Do you save the temperature data into the FRAM or a SD card?

    If you want to set the system up to 16MHz, you have to add one line in the code before setting the clock system.
    // Configure one FRAM waitstate as required by the device datasheet for MCLK
    // operation beyond 8MHz _before_ configuring the clock system.
    FRCTL0 = FRCTLPW | NWAITS_1;

    Best regards,
    Cash Hao
  • Hi Cash Hao

    Thank you for the reply, implementing the line you provided allowed the system to a read cycle at 10kHz when setting the main clock to 16MHz (as opposed to ~5kHz previously).

    This is, unfortunately, still slower than desired. Do you think this may be inherent in the sensor I am using? I may have to look into alternatives if this is the case.

    Thank you again

    JSud
  • Hi JSud,
    I disassembly your code, it needs around 440 clock cycles to finish a read command and a store command. That means if the system clock is 8MHz, the frequency of your cycle should be around 18.2kHz. But what you get is 10kHz. so I think the sensor may be the boundaries.

    Best regards,
    Cash Hao

**Attention** This is a public forum