2023-03-29 07:36 AM
int main (){
uint16_t txConvertData[2]={0};
uint16_t rxConvertData[2]={0};
const uint16_t ConvertCommandMask = 0b0000000000000000;
while(1){
for (int j = 0; j < 2; j++) {
// Send read command
HAL_GPIO_WritePin(IN_SPI2_CS_GPIO_Port, IN_SPI2_CS_Pin, GPIO_PIN_RESET);
hal_status = HAL_SPI_TransmitReceive(&hspi2, (uint8_t*) &txConvertData[j], (uint8_t*) &rxConvertData[j], 1, 100);
HAL_GPIO_WritePin(IN_SPI2_CS_GPIO_Port, IN_SPI2_CS_Pin, GPIO_PIN_SET);
HAL_Delay(100);
if (hal_status != HAL_OK) {
printf("HAL SPI TransmitReceive error: %d\r\n", (int) hal_status);
}
}
}
Hello,
On a custom designed PCB, there is STM32F407 processor and its SPI interface get a data from an external ADC. My aim is that getting the converted signal from the ADC continuously. When I started to debug session, I got the conversion value just one at time. Do you have a suggestion to solve the problem?
In addition, I tried to plot SW trace plotting in the debug session but I didn't get nothing.
2023-04-11 06:08 AM
Hello @AE104,
Try to read through DMA to be able to continuously receive data from the ADC.
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.
2023-04-11 08:31 AM
What ADC are you communicating with?