cancel
Showing results for 
Search instead for 
Did you mean: 

I'm having troble reading the values of te 2 SARADC drivers simultaniously. I wanted to read the values of ADC_1 and ADC_2. I have the SPC584B-DISP

MYoun.7
Associate

 I tried to change the chanel number but it didn't work, and i also tried to change the driver under test but it gives me an error.

here is my void main0693W00000UoQWcQAN.pnghere is the pin map

0693W00000UoQWxQAN.png 

1 REPLY 1
ODOUV.1
ST Employee

Hello,

Tel me if I am wrong, but I suppose that what you need it to read 2 input analogue values simultaneously.

If so, you do not need to open 2 drivers but only one which is able to read several channels (eg 2 channels).

You are using SPC584B-DISP Discovery2 board.

You can find useful information in the User-manual :

https://www.st.com/resource/en/user_manual/um2462-spc584bdisp-discovery-board-stmicroelectronics.pdf

You can find that many ADC channels are mapped to X9 connector:

 0693W00000UoS17QAF.pngFor example, with the 2 firsts, PI3_ADC-AN39 and PI5_ADC-AN41, it means channel 39 can be programmed as input pad I[3] of MCU and connected to X9:B26.

And channel 41 can be programmed as input pad I[5] of MCU and connected to X9:A27.

In pin map wizard you can program PI3 to input ADC_SAR_12b_SV_0:

 0693W00000UoS1CQAV.pngyou can also program PI5 to input ADC_SAR_12b_SV_0:

 0693W00000UoS1WQAV.png 

In low level drivers component – saradc settings:

0693W00000UoS20QAF.pngYou can keep the Supervisor driver only

In channels configuration, you must have channels 39 and 41:

 0693W00000UoS25QAF.pngThen you can modify the demo code “SPC584Bxx_RLA SARADC Test Application for Discovery 2�? with

#define NUMOFCHANNELS 2U

And

uint8_t anp[NUMOFCHANNELS] = {39U, 41U};

uint16_t value[NUMOFCHANNELS] = {0U, 0U};

 0693W00000UoS2PQAV.pngThis way value[0] and value[1] will contains values from ADC channel 39 and 41

Best regards.