cancel
Showing results for 
Search instead for 
Did you mean: 

H523 can't run HW SPI

wegi01
Associate III

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:

0.jpg

 

1.jpg

 

2.jpg

3.jpg4.jpg

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?

2 REPLIES 2
TDK
Super User

> 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.

If you feel a post has answered your question, please click "Accept as Solution".
wegi01
Associate III

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.