cancel
Showing results for 
Search instead for 
Did you mean: 

STM32- Nucleo-H755ZIQ- LED blink- SPI

STork.1
Associate III

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);

1 ACCEPTED SOLUTION

Accepted Solutions
STork.1
Associate III

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

Thanks for your reply

View solution in original post

2 REPLIES 2
FBL
ST Employee

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 Accept as Solution on the reply which solved your issue or answered your question.


I'm out of offce with limited access to my emails.
Happy New Year!
STork.1
Associate III

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

Thanks for your reply