Netduino Plus 2 board + BME280
Posted: Thu Dec 15, 2022 6:37 pm
Hi all.
Recently I successfully got ethernet running on a Netduino Plus 2.
Thread from: viewtopic.php?t=1771
Now I have a problem with libraries for temperature sensors. I am trying to read the temperature from DHT22 and BME280, unfortunately without success, none of the libraries work. Could it be a problem with configuring the clock settings?
I would like to add that I tested the libraries for the above-mentioned sensors on the STM32F4-Discovery board, Leonardo and also on BluePill. Everything works on these boards.
Can anyone verify that the settings I used are correct for Netduino Plus 2?
Also I changed the definition of HSE_VALUE in file stm32f4xx_hal_conf_default.h to 25000000.
Recently I successfully got ethernet running on a Netduino Plus 2.
Thread from: viewtopic.php?t=1771
Now I have a problem with libraries for temperature sensors. I am trying to read the temperature from DHT22 and BME280, unfortunately without success, none of the libraries work. Could it be a problem with configuring the clock settings?
I would like to add that I tested the libraries for the above-mentioned sensors on the STM32F4-Discovery board, Leonardo and also on BluePill. Everything works on these boards.
Can anyone verify that the settings I used are correct for Netduino Plus 2?
Code: Select all
extern "C" void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
/**Configure the main internal regulator output voltage
*/
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
/**Initializes the CPU, AHB and APB busses clocks
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 25;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
Error_Handler();
}
/**Initializes the CPU, AHB and APB busses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK) {
Error_Handler();
}
/* Ensure CCM RAM clock is enabled */
__HAL_RCC_CCMDATARAMEN_CLK_ENABLE();
}
void setup()
{
//clock setup
//SystemClock_Config(); (extern)
//PA8 as clock for enc28J60
HAL_RCC_MCOConfig(RCC_MCO1, RCC_MCO1SOURCE_HSE, RCC_MCODIV_1);
//PB4 as MISO
SPI.setMISO(PB4);
//PC8 as chip sellect
Ethernet.init(PC8);
//start ethernet
Ethernet.begin(mac, Eth_ModuleIP);
}