My problem was actually that I was using the wrong Chip Select line in hardware (connecting to a different pin on the processor). The pin that I connected to the CS line of the BMP280 was always low.What threw me off is that I was able to get the chip ID back from calling bmp280_init(dev), since that is the first SPI comminication that takes place. But because the CS line never went high again, all following communications to the chip were garbage. Something to think about when troubleshooting.
... View more
I am using version 3.3.4 of bmp280.h, bmp280.c, and bmp280_defs.h I am able to read my BMP280 chip ID, and also read out the calibration parameters, so I know that I am generally communicating with the BMP correctly. My problem starts when trying to read bmp280_get_uncomp_data. Taking the temperature portion for example, when I try to sprint ucomp_data.uncomp_temp I get what appears to be a lot of zeros and random readings: 0 0 524288 313603 792199 606717 458767 812801 0 816 ...etc. About half of the readings are zeros. I have read out the t_fine value that is stored on the device just to make sure that I am reading a 32-bit number correctly. t_fine always returns the same value of 57035. I don't know if the problem is that I am not reading MSB first, or if somehow I am reading the wrong location for temperature data. Any suggestions would be most welcome. I have attached my main.c for reference. Please pardon all the commented-out code in main.c as I have been trying lots of things. Disclaimer: I do not write code for a living, so my apologies if I botched something obvious.
... View more