2025-07-24 5:43 PM
Hello,
I spend a lot of time to tried running HW SPI on H523CET6. On the other mcu like F411 it work without any problems. In this case SPI work only when I do it in software mode:
//=====================================================================================
#define DO_LO HAL_GPIO_WritePin(LCD_MOSI_GPIO_Port, LCD_MOSI_Pin, GPIO_PIN_RESET);
#define DO_HI HAL_GPIO_WritePin(LCD_MOSI_GPIO_Port, LCD_MOSI_Pin, GPIO_PIN_SET);
#define CLK_LO HAL_GPIO_WritePin(LCD_CLK_GPIO_Port, LCD_CLK_Pin, GPIO_PIN_RESET);
#define CLK_HI HAL_GPIO_WritePin(LCD_CLK_GPIO_Port, LCD_CLK_Pin, GPIO_PIN_SET);
//=====================================================================================
static void Transmit_Byte(uint8_t transfer){
//==========================================================
#define HW_SPI
//==============
#ifdef HW_SPI
extern SPI_HandleTypeDef hspi1;
HAL_SPI_Transmit(&hspi1, &transfer, 1, 100);
//==========================================================
#else
uint32_t i;
for(i = 0 ; i < 8 ; i++){
if((transfer & 0x80) != 0) { DO_HI; }
else { DO_LO; }
CLK_LO;
transfer =(transfer << 1);
CLK_HI;
}
#endif
//===========================================================
}
I'm not pretty sure what I should to do more for properly running SPI in H523. My setup looks like:
UART1 on PA9/PA10 working without any problem, but the HW SPI doesn't. IOC file in attachment. I'd look at this via oscilloscope. CLK look like work properly, also MOSI he's not dead. Should I do any additional configurations or so?
2025-07-24 5:47 PM - edited 2025-07-24 5:47 PM
> CLK look like work properly, also MOSI he's not dead.
So CLK works? and MOSI works? The heck does "MOSI he's not dead" mean? What isn't working about SPI then?
Don't see how UART configuration is relevant here.
2025-07-24 5:58 PM
UART is example it work and can running on this same APB2 BUS. I don't have logic analyzer and don't see what exactly ongoing on the MOSI just I see the change of states. But at the end what doing properly via software SPI, it doesn't work properly via hardware SPI, I don't know why. Also a lot of new settings in H5 series confusing me.