stm32 blue pill setup with MLX90640

Hi Everyone,

I have been trying to get Example 2 of the sparkfun mlx90640 library to work with the stm32 blue pill in the Arduino IDE:

I had to add "(byte)" to the Wire.write functions in MLX90640_I2C_Driver.cpp to get it to compile:

    Wire.beginTransmission(_deviceAddress);
    Wire.write((byte)startAddress >> 8); //MSB
    Wire.write((byte)startAddress & 0xFF); //LSB
    if (Wire.endTransmission(false) != 0) //Do not release bus
//Write two bytes to a two byte address
int MLX90640_I2CWrite(uint8_t _deviceAddress, unsigned int writeAddress, uint16_t data)
{
  Wire.beginTransmission((uint8_t)_deviceAddress);
  Wire.write((byte)writeAddress >> 8); //MSB
  Wire.write((byte)writeAddress & 0xFF); //LSB

It seems to have an issue from the Wire.read() function. All Wire functions used prior to that do not return errors and give the expected number of bytes available for reading. Currently all the temperature outputs are "0.00".

Is there any other changes I can try in order to get it to work?

Another weird issue I've had with the bluepill is that void setup() doesn't seem to execute all of the lines of code such as Serial.print etc. If anyone knows a fix for this that would be great.

PS this is my first post so if I've missed anything out let me know and I'll post it on here!

Cheers

Example2_OutputToProcessing.ino (3.31 KB)

MLX90640_API.cpp (31.4 KB)

MLX90640_API.h (2.34 KB)

MLX90640_I2C_Driver.cpp (3.08 KB)

MLX90640_I2C_Driver.h (1.52 KB)