I'm working on a project with stm32f4 Discovery board (stm43f407xx), I'd like to communicate with a SPBTLE-RF (IDB05A1 board).
I'm using SPI2 with prescaler 8 (I have 168Mhz, apb1 runs at 42 Mhz so the clock is 5.25 Mhz), the datasheet says that spi clock in bluenrg-ms works up to 8Mhz, but I cannot communicate with the chip.
I have tried with one nucleo board (spi1 prescaler 4) and it works very well so the HW is ok, then I have tried with two discovery board without success.
I've double checked all connection and the software on the discovery is the same of the nucleo board modified only for pin-stuff and clock.
Anyone have worked with this HW or can suggest something?
I have resolved! Now I explain, I forgot to declare the right interrupt handler since bluenrg use 5 wire SPI with an IRQ pin that has to be handled by interrupt.
An interesting thing is that I'm using a prescaler 16 because otherwise it doesn't work, I don't know why because with prescaler 8 the clock frequency of SPI2 is below the maximum 8Mhz. Here there is my initialization code for the clock:
void SystemClock_Config(void) {
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
__HAL_RCC_PWR_CLK_ENABLE();
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
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 = 8;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 4;
HAL_RCC_OscConfig(&RCC_OscInitStruct);
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;
HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5);
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
}