Skip to main content
STork.1
Associate III
August 22, 2022
Solved

STM32- Nucleo-H755ZIQ- LED blink- SPI

  • August 22, 2022
  • 2 replies
  • 2272 views

0693W00000QODqWQAX.pngPreviously I wrote a program for - Nucleo-H755ZIQ in which I used SPI- UART- RTOS.

After a long time, I wanna make a new stm32 project and reuse some previous function I was using correctly before.

The problem is that not only those functions don't work but also I can not even set and reset an led .

Here are my function which were working on the current MCU:

void adxl_355_write(uint8_t reg_adress, uint8_t reg_value ){
 
	uint8_t data[2];
	uint8_t WRITE_BYTE = 0x00;
	reg_adress=(reg_adress << 1) | WRITE_BYTE;
	data[0]= reg_adress;
	data[1]=reg_value;
	HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET);// set SPI1_CS LOW
	HAL_SPI_Transmit(&hspi1, data, 2, 1);
	HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_SET);// set SPI1_CS HIGH
 
}
 
uint8_t adxl_355_Read(uint8_t reg_adress){
	//READ_BYTE
	uint8_t byte_ToBe_received=0;
	uint8_t m_reg_adress=0;
	uint8_t READ_BYTE = 0x01;
 
	m_reg_adress=(reg_adress << 1) | READ_BYTE; //modified register address
	HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET);// set SPI1_CS LOW
	HAL_SPI_Transmit(&hspi1, &m_reg_adress, 1, 1);
	HAL_SPI_Receive(&hspi1, &byte_ToBe_received, 1, 1);
	HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_SET);// set SPI1_CS HIGH
	return byte_ToBe_received;
 
}

 Here are the codes inside the while loop :

HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_RESET);
	 HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_RESET);
	 HAL_GPIO_WritePin(GPIOE, GPIO_PIN_1, GPIO_PIN_RESET);
	 HAL_Delay(500);
	 HAL_GPIO_WritePin(GPIOB, GPIO_PIN_0, GPIO_PIN_SET);
	 HAL_GPIO_WritePin(GPIOB, GPIO_PIN_14, GPIO_PIN_SET);
	 HAL_GPIO_WritePin(GPIOB, GPIO_PIN_1, GPIO_PIN_SET);
	 HAL_Delay(500);

This topic has been closed for replies.
Best answer by STork.1

Hi , the probnlem was that I forgot to assign SPI_CS pin to the m7 Core inside the CubeMX .

Thanks for your reply

2 replies

Technical Moderator
August 24, 2022

Hi @STork.1​ 

I would like to know what changed since it was working (Hardware or software changes)?

Then, can you test with a ready to use example from STM32CubeH7? This example should work properly for NUCLEO-H755ZI

To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL
STork.1
STork.1AuthorBest answer
Associate III
September 12, 2022

Hi , the probnlem was that I forgot to assign SPI_CS pin to the m7 Core inside the CubeMX .

Thanks for your reply