Skip to content

STM32 library for MAX31855 temperature sensor using HAL and SPI

License

Notifications You must be signed in to change notification settings

SimpleMethod/STM32-MAX31855

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

STM32 MAX31855

STM32 library for MAX31855 temperature sensor using HAL and SPI

proof of concept

Example:

 /* USER CODE BEGIN 2 */
	MAX31855_Init(&MAX31855_Handle, &hspi3,SPI3_NSS_GPIO_Port, SPI3_NSS_Pin);
	uint32_t Timer = HAL_GetTick();
 /* USER CODE END 2 */
 /* Infinite loop */
 /* USER CODE BEGIN WHILE */
	while (1) {

		if ((HAL_GetTick() - Timer) > 1000) {
			MAX31855_ReadData(&MAX31855_Handle);
			if(!MAX31855_GetFault(&MAX31855_Handle))
			{
			printf("Temperature: %f\r\nInternal temperature: %f\r\n", MAX31855_GetTemperature(&MAX31855_Handle),MAX31855_GetTemperatureInFahrenheit(&MAX31855_Handle));
			}
			Timer = HAL_GetTick();
		}
		/* USER CODE END WHILE */
		/* USER CODE BEGIN 3 */
	}
 /* USER CODE END 3 */

SPI Settings:

Options Value
Mode Full-Duplex Master
Frame Format Motorola
Data Size 8 Bits
First Bite MSB First
Clock Polarity (CPOL) Low
Clock Phase (CPHA) 1 Edge

If using SPI in "Receive only the Master" mode, see this case: #1

For using printf with float is needed add -u _printf_float in MCU GCC linker

About

STM32 library for MAX31855 temperature sensor using HAL and SPI

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages