Tool/software:
Hi all,
we're designing an OEM gas flow meter as replacement for a sensor based on hot wire measurement. Power consumption during measurement is not a primary concern, but the measurement rate should be as high as possible to reduce measurement dead time and allow for averaging to reduce standard deviation of measurement values.
Development is done using the EVM430-FR6043, containing the MSP430FR6043 with its integrated USS_A module. The application itself is simple: An I²C interface to start/stop measurement and read out measurement results and of course the two ultrasonic transducers for the actual flow measurement.
The firmware is roughly based on the example code, which performs measurements in a loop and output results using a UART. We've modified this to take measurements as fast as possible in the main while(1) loop (no timer anymore) and replaced the UART by an I²C interface. This all works, but now we're seeing random resets of the MCU when the measurement is running and values are read out using I²C at a high rate.
Observations:
I'm quite out of ideas by now about what could cause those issues.
My question: Are there any constraints in regard to interrupts while USS functions are running? Like maximum execution times, certain modules or memory regions which may not be used, etc.?
Thanks and best regards,
Philipp
Problem solved. To achieve the shortest possible conversion time, I set the DCO to 24MHz, which supplies MCLK. And obviously I didn't carefully check the datasheet, because the FR6043 has a specified maximum MCLK frequency of 16MHz. That partially explains the weird behavior with no real pattern, although it's quite funny that the issue showed only when using the USS and I²C, but not when using only either one. Anyway, problem solved and lesson learned.
There's a bit more to mention. I could have discovered this frequency problem much earlier, as I've actually once tested reducing the MCLK frequency and the crashes didn't go away. However, it now shows that I actually faced two bugs at the same time, with almost identical symptoms:
So my fix was very simple in the end:
/* Disable interrupts globally around capture function. This * seems to be required, as otherwise random crashes happen * when there is I2C traffic. Since the capture is mostly * about waiting in an LPM, interrupts are mostly enabled * anyway, so this is not too bad for latency. */ __disable_interrupt(); code = USS_startLowPowerUltrasonicCapture(&gUssSWConfig); __enable_interrupt();
I just checked the documentation again and found no hint about the requirement of having interrupts disabled upon enter. Given that some care has been taken in the library functions to disable and restore the interrupt flag where appropriate, I think this is rather a bug than an omission in the documentation, but unless it is fixed, I think that this requirement should be prominently noted in the library docs.
In fact, I just found a response of user "Cash Hao11" in another thread stating that "the interrupts does not impact the USS capture process.": https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1379232/msp430fr5043-water-demo-in-ccs-scale-factor-in-resultsfixpoints/5270922#5270922
Who knows, may I just had bad luck...
**Attention** This is a public forum