cancel
Showing results for 
Search instead for 
Did you mean: 

Wi-Fi Combo

Anonymous
Not applicable

I am trying to use more than one ADC input in my application. I could not get all the ADC inputs sampled independent of each other.

I have connected ADC_1 to 3.3V and ADC_3 to ground for testing.

Here is my code snippet.

..

   wiced_adc_init( WICED_ADC_1, 5 );
   wiced_adc_init( WICED_ADC_3, 5 );


    while(1) {

      wiced_adc_take_sample(WICED_ADC_3, &adc3_value );
       WPRINT_APP_INFO(("adc3 %d\r\n,", adc3_value));
      wiced_adc_take_sample(WICED_ADC_1, &adc1_value );

      WPRINT_APP_INFO(("adc1 %d,\r\n", adc1_value));

    }

adc3_value and adc1_value are same and the value printed is 0 (0V)

Printed adc*value depends on which ADC is initialized latest.

Could it be a driver code issue?

Also I could not get the single step debug mode working to understand more on the issue.

Any help or pointers will be useful.

Apology for re posting Using more than one ADC input in WICED wifi board Problem but my problem is exactly.

That's why i'm re posting the problem.

Regards,

Prashant

0 Likes
1 Solution
Anonymous
Not applicable

Please try the attached patch to the ADC driver

This should replace the one in WICED/platform/MCU/STM32F2xx/peripherals

This should work for the SN8205

Please let me know the results

View solution in original post

14 Replies
MichaelF_56
Moderator
Moderator

Adding seyhan​, the author of the ADC Setup and Read help article.

0 Likes
Anonymous
Not applicable

Which platform are you using this on?

Can you confirm from the platform files that adc 1 and adc 3 are setup in the platform correctly? 

0 Likes
Anonymous
Not applicable

I am using Sn8205 with wiced sdk 3.1.2 NetX Duo OS.

If i am usin ADC1 and ADC3 separatly than it is working properly.

But when i'm trying to use both ADC then it only reads last initialized ADC1 value.

i.e,

   wiced_adc_init( WICED_ADC_1, 5 );

   wiced_adc_init( WICED_ADC_3, 5 );

in this case

  wiced_adc_take_sample(WICED_ADC_3, &adc3_value );
       WPRINT_APP_INFO(("adc3 %d\r\n,", adc3_value));
      wiced_adc_take_sample(WICED_ADC_1, &adc1_value );

      WPRINT_APP_INFO(("adc1 %d,\r\n", adc1_value));

Both adc1 and adc3 reads ADC3 value.

0 Likes
Anonymous
Not applicable

Any update on this issue??

0 Likes
MichaelF_56
Moderator
Moderator

We are working on this internally and should have an update next week.

Anonymous
Not applicable

any update regarding issue?

0 Likes
Anonymous
Not applicable

Currently in our SDK support for multiple ADC is broken. This would need to be fixed and released as a future SDK

For now I am working on a patch to unblock you and will add it to this thread soon

Anonymous
Not applicable

Please try the attached patch to the ADC driver

This should replace the one in WICED/platform/MCU/STM32F2xx/peripherals

This should work for the SN8205

Please let me know the results

View solution in original post

Anonymous
Not applicable

Now it's working.Thank you for your support.

0 Likes
Anonymous
Not applicable

@nsankar, I need the same patch for running 2 ADCs for the BCM43341 platform i.e. STM32F4xx?

0 Likes
Anonymous
Not applicable

Attached for the 4xx platform

Anonymous
Not applicable

Thanks nsankar.

It worked for the Inventek ISM43341_M4G_L44 platform.

For future reference, please use the following platform changes:

typedef enum

{

    WICED_ADC_1,

    WICED_ADC_2,

    WICED_ADC_3,

    WICED_ADC_4,

    WICED_ADC_5,

    WICED_ADC_MAX, /* Denotes the total number of ADC port aliases. Not a valid ADC alias */

    WICED_ADC_32BIT = 0x7FFFFFFF,

} wiced_adc_t;

/* ADC peripherals. Used WICED/platform/MCU/wiced_platform_common.c */

const platform_adc_t platform_adc_peripherals[] =

{

    [WICED_ADC_1] = {ADC1, ADC_Channel_3, RCC_APB2Periph_ADC1, 1, &platform_gpio_pins[WICED_GPIO_12]}, /* PA3, ADC0 */

    [WICED_ADC_2] = {ADC1, ADC_Channel_4, RCC_APB2Periph_ADC1, 1, &platform_gpio_pins[WICED_GPIO_21]}, /* PA4, ADC1 */

    [WICED_ADC_3] = {ADC1, ADC_Channel_5, RCC_APB2Periph_ADC1, 1, &platform_gpio_pins[WICED_GPIO_19]}, /* PA5, ADC2 */

    [WICED_ADC_4] = {ADC1, ADC_Channel_6, RCC_APB2Periph_ADC1, 1, &platform_gpio_pins[WICED_GPIO_17]}, /* PA6, ADC3 */

    [WICED_ADC_5] = {ADC1, ADC_Channel_7, RCC_APB2Periph_ADC1, 1, &platform_gpio_pins[WICED_GPIO_18]}, /* PA7, ADC4 */

};

Apparently, ADC4 or PA7 does not work. The rest of the ADCs do work in silo and in combo.

Anonymous
Not applicable

@nsankar, I wanted to have the ADC sample stream ... I see that the function is not implemented in platform_adc.c

platform_result_t platform_adc_take_sample_stream( const platform_adc_t* adc, void* buffer, uint16_t buffer_length )

{

    UNUSED_PARAMETER( adc );

    UNUSED_PARAMETER( buffer );

    UNUSED_PARAMETER( buffer_length );

    wiced_assert( "unimplemented", 0!=0 );

    return PLATFORM_SUCCESS;

}

Do you know how I should go about implementing this?

0 Likes
Anonymous
Not applicable

I see an example for the STMF4 elsewhere ...

Thomas's World: STM32F4 and “Most” of What You Ever Wanted to Learn about Its Analog Digital Convert...

Since the ADC only has a single register that stores the information of the last conversion, there are only two ways to retrieve the values that are sampled through the scan.

  • Configure an interrupt to trigger after each channel is sampled,
  • Configure the DMA controller to copy the data of the channels into a defined memory location.

Has anyone tried this on WICED SDK for implementing platform_adc_take_sample_stream() function?

0 Likes