Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

PSoC™ 6 Forum Discussions

KY
Level 1
5 sign-ins First like given First reply posted
Level 1

Hi, I am working on a bring up of CYBLE-416045-02, and using the Modus ADC sample code as template.

Originally, the sample code map P10_0 as the input, and I have reading from this pin

Then, I map it to P10_3, and it still work.

My problem is, if I want to have 4 ADC channel reading, e.g. P9_0, P10_5, P10_3 and P10_4, how should I initiate them?

I tried to initiate them under SINGLE_CHANNEL one by one, but got Initialization Failed Error 67240448

Should I define SINGLE_CHANNEL or MULTI_CHANNEL?

If I have to use MULTI_CHANNEL, how can I config it as single end mode? because the sample code comes with differential mode. Those 4 channels are individual reading (0V-3.2V), I do not have VREF for each of them.

 Thanks

 

0 Likes
1 Solution
Srivastav
Moderator
Moderator 100 sign-ins 10 likes received 5 likes given
Moderator

Hi @KY ,

 

I went through the Code Example "ADC basic" and It has the implementation of both SINGLE_CHANNEL & MULTI_CHANNEL. Single channel configuration uses channel 0 in single ended mode. Multiple channel configuration uses two channels, channel 0 in single ended mode and channel 1 in differential mode. You can refer to adc_multi_channel_init() for more details. Also, You can refer to cyhal_adc_channel_init_diff() to see how to Initialize a channel and configure it to scan P10_0 in single ended mode.

You can also refer to https://github.com/Infineon/mtb-example-psoc6-adc-basic/blob/master/README.md for more details


Kind Regards
Arpit Srivastav

View solution in original post

0 Likes
3 Replies
Srivastav
Moderator
Moderator 100 sign-ins 10 likes received 5 likes given
Moderator

Hi @KY ,

 

I went through the Code Example "ADC basic" and It has the implementation of both SINGLE_CHANNEL & MULTI_CHANNEL. Single channel configuration uses channel 0 in single ended mode. Multiple channel configuration uses two channels, channel 0 in single ended mode and channel 1 in differential mode. You can refer to adc_multi_channel_init() for more details. Also, You can refer to cyhal_adc_channel_init_diff() to see how to Initialize a channel and configure it to scan P10_0 in single ended mode.

You can also refer to https://github.com/Infineon/mtb-example-psoc6-adc-basic/blob/master/README.md for more details


Kind Regards
Arpit Srivastav

0 Likes
KY
Level 1
5 sign-ins First like given First reply posted
Level 1

Hi Arpit,

Thank you.

I can configure multi channel with single end now, then a follow up question...

I cannot configure P9_0 as ADC (not even single channel), while learn from the README the PSoC6 HAL has restriction to map any GPIO as ADC, which may be the reason. From the CYBEL-416045-02 datasheet,  any GPIO does able to be ADC.

Could you advise how to release the restriction?

 

0 Likes
RodolfoGL
Employee
250 sign-ins 5 comments on KBA First comment on KBA
Employee

The CYHAL ADC driver only support pins from port 10.

You might need to use the PDL ADC driver to use port 9. You can use the device configurator to establish the connections between the ADC and the pins. With PDL, you can mix pins from port 10 and port 9. The device-configurator will help to establish the routing.