Hi,
Thanks for the offer Mark03, I may PM you in future if that's okay when I more onto making optimising code.
I have got software pulse triggering working using "__HAL_TIM_ENABLE(&htim1)" but have a problem with the code shown below.
HAL_TIM_OnePulse_Start(&htim1, TIM_CHANNEL_1);
volatile uint16_t array [300];
HAL_Delay(1000); // let ADC power up
while(1)
{
for(int n=0;n<300;n++) // acquisition loop
{
if (hspi1.State != HAL_SPI_STATE_BUSY_RX)
{
__HAL_TIM_ENABLE(&htim1); //send pulse
HAL_SPI_Receive(&hspi1,(uint8_t*)array[n],1,1); //clock data
HAL_Delay(1);
}
}
}
With the HAL_Delay(1); in the loop, the pulses look fine but for some reason the HAL_SPI_Receive function isn't initiated - there are no clocks. When I remove the delay, the clock is there but the pulse output is almost inverted being high most of the time, and even runs over the receive clock?
I don't quite understand what's going on as I have the != HAL_SPI_STATE_BUSY_RX there but I don't think it's working?
Thanks