Skip to main content
Visitor II
February 9, 2025
Question

STM32WL55J sharing ADC and SWJ-DP

  • February 9, 2025
  • 3 replies
  • 679 views

Hi, 

For a project I need 12 ADCs. STM32WL55JCU6 has all the necessary ADCs but two of them are shared with SWDIO and SWCLK pins. Is there any good suggestion for being able to use both these functions at the same time?

3 replies

STTwo-32
Technical Moderator
February 10, 2025

Hello @Emendion 

I think it should be possible. You have to implement a SW switcher of functions that create the initialization of the pin for the needed function. After that and when it has to, you should switch the function of the pin. For example, you can initialize the pin as ADC channel. After that, when you need it for SWD. You can stop the ADC channel and reconfigure it for SWD. Then, you can reinitialize the pins and restart the ADC for them after finishing the SWD task.

PS: in this case you can't use the debugger will working on ADC. 

Best Regards.

STTwo-32

Ozone
Principal
February 10, 2025

> For example, you can initialize the pin as ADC channel. After that, when you need it for SWD. You can stop the ADC channel and reconfigure it for SWD. Then, you can reinitialize the pins and restart the ADC for them after finishing the SWD task.

I would want to see a life example of this approach.
Without the attached debugger bailing out.

Andrew Neil
Super User
February 10, 2025

Indeed.

IME, Once the debugger has lost connection, it's gone - there is no "resume connection" feature.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Andrew Neil
Super User
February 10, 2025

@Emendion wrote:

Is there any good suggestion for being able to use both these functions at the same time?


No - a pin can only do one thing at any one time.

So, as @STTwo-32 suggests, you will have to switch between the two.

But this will mean that the debugger will lose connection while you have the pins switched to ADC mode.

A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
Ozone
Principal
February 10, 2025

Yes, but you will most likely come to regret it.

Use an external ADC.

By the way, I hope you have checked these 12 ADC channels don't include internal ones'.