This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

adc shockburst

I am trying to send continuously sampled analog input using NRF24LE1 using Shock burst,The transmitter is not working while trying sample continuously.please help. code included. ADC part


hal_adc_set_input_channel(HAL_ADC_INP_AIN0); hal_adc_set_reference(HAL_ADC_REF_INT); hal_adc_set_input_mode(HAL_ADC_SINGLE); hal_adc_set_conversion_mode(HAL_ADC_CONTINOUS); hal_adc_set_sampling_rate(HAL_ADC_2KSPS); hal_adc_set_resolution(HAL_ADC_RES_8BIT); hal_adc_set_data_just(HAL_ADC_JUST_RIGHT);

// Enable MISC interrupts to enable ADC interrupt MISC = 1; // Enable global interrupts EA = 1; // Start ADC conversion hal_adc_start();


TX part


ADC_ISR() { buff[0]= hal_adc_read_LSB(); L01_Init( ); L01_SetTXMode( );
L01_WriteTXPayload_Ack(buff, 1 );

	RFCE=1;
	
	

}

Parents
  • Hi Edvin

    The formatting of your code looks a bit wonky, but from what I can tell you are trying to initialize and configure the radio as well as upload a new TX payload in every ADC interrupt?

    This is not a good idea, as the ADC interrupt will occur every 500us when you are sampling the ADC at 2kHz.

    Instead, you should initialize the radio only once after resetting the device, and simply store the ADC data to a buffer inside the ADC interrupt. To optimize the radio usage and power consumption I would recommend sending chunks of 32 byte in a single payload, rather than sending each 1 byte sample as a one byte packet.

    Best regards Torbjørn

Reply
  • Hi Edvin

    The formatting of your code looks a bit wonky, but from what I can tell you are trying to initialize and configure the radio as well as upload a new TX payload in every ADC interrupt?

    This is not a good idea, as the ADC interrupt will occur every 500us when you are sampling the ADC at 2kHz.

    Instead, you should initialize the radio only once after resetting the device, and simply store the ADC data to a buffer inside the ADC interrupt. To optimize the radio usage and power consumption I would recommend sending chunks of 32 byte in a single payload, rather than sending each 1 byte sample as a one byte packet.

    Best regards Torbjørn

Children
Related