cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with SPI on nucleo H7A3ZIQ

AlexandrosAA
Associate III

Hey guys. I'm trying to use the SPI1 interface on the aforementioned nuncleo board, but no luck whatsoever.

I want to transmit 2 3Byte commands to a dac device. The first one is 48,0,0 and the second one is 55,255,255. My code is:

 

 

 

uint8_t msg_Tec[3]={0x30,0x00,0x00};

HAL_GPIO_WritePin(CC_GPIO_Port, CC_Pin, GPIO_PIN_RESET);
HAL_SPI_Transmit(&hspi1, spiCommand,  3, HAL_MAX_DELAY);
while(HAL_SPI_GetState(&hspi1) != HAL_SPI_STATE_READY);
HAL_GPIO_WritePin(CC_GPIO_Port, CC_Pin, GPIO_PIN_SET);

 

 

 

I manually asssigned a pin as CC, set to MSB First and spi mode to 01. Here are some pictures from an oscilloscope that i used to check the  SPI signal outputs. I've also noticed a couple of concerning things here, like a good ammount of background noise ( even though i used a 70 Ohm resistance in series with the signal outputs to reduce it) and data transmission begins atleast a couple of clock cycles before the transmission of the actual clock output. In addition the commands seem to be transmitted in reverse, even though MSB first is selected and the transmission still goes on even after 24 bits have already been transmitted.

Tried to send the exact same commands with a pico, and got the result that i wanted.

 

SPI message is 00110000 and 16 0s on stmsSPI message is 00110000 and 16 0s on stmsSPI message is 00110111 and 16 1s on stmSPI message is 00110111 and 16 1s on stmSPI message is 00110000 and 16 0s on picoSPI message is 00110000 and 16 0s on picoSPI message is 00110111 and 16 1s on picoSPI message is 00110111 and 16 1s on pico

0 REPLIES 0