Go Down

Topic: stm32 blue pill setup with MLX90640 (Read 107 times) previous topic - next topic

joe_kru

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:

https://github.com/sparkfun/SparkFun_MLX90640_Arduino_Example/blob/master/Firmware/Example2_OutputToProcessing/Example2_OutputToProcessing.ino

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

Code: [Select]

    Wire.beginTransmission(_deviceAddress);
    Wire.write((byte)startAddress >> 8); //MSB
    Wire.write((byte)startAddress & 0xFF); //LSB
    if (Wire.endTransmission(false) != 0) //Do not release bus



Code: [Select]
//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

Go Up