Use DA14681 SWD pins as ADC

Learn MoreFAQsTutorials

6 posts / 0 new
Last post
mahmed106
Offline
Last seen:1 month 2 weeks ago
加入:2019-05-03所
Use DA14681 SWD pins as ADC

Hi dialog

i m using a board based on DA14681 and i want to use 6 thermistors , and for that i have to use one ADC pin that is shared with SWD pins, (SWD CLK and SWDIO).

I confured this pin but it didnt work, then from this query i came to realize that debugger needs to be disabled for this pin to work, (https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bl...)

but still no progress.

1stly i dont know where in the code i need to disable the debugger. I did this before peripherals initilization and i think it disabled the debugger, cz now JTAG is not programming the board. So i had to burn the code via SUOTA..

Can i program a SUOTA based code via serial , if my JTAG is disabled cz of this ADC pin?

2ndly even after disabling the debugger, my ADC still reads no data,, anything else which i m missing in the code?

Please help , Thanks

Device:
PM_Dialog
Offline
Last seen:21 hours 15 min ago
工作人员
加入:2018-02-08 11:03
Hi mahmed106,

Hi mahmed106,

谢谢你,stion. As mentioned in the attached forum post, the P2_4 is used for SWCLK and ADC, so you should disable the debugger in case you would like to use as ADC pin.

The debugger should be disabled at the system initialization and before the periph_init() function. In the periph_init(), you should configure the P2_4 as a ADC pin. By this way, the debugger is disabled in your software so you cannot use JTAG interface to interact with QSPI flash. Instead of using JTAG interface for erase/programming the flash, you can use the UART interface (erase_qspi_serial_win / program_qspi_serial_win scripts).

If you disable the debugger in application layer, you should erase first the flash over UART and then you can use the JTAG for the programming. Disabling the debugger in the application code, does not means permanent debugger disable.

Another possible solution might be to re-configure the P2_4 to ADC every time you want to use the ADC peripheral block. After using it to capture the ADC, you should configure it back to SWCLK.

Thanks, PM_Dialog

mahmed106
Offline
Last seen:1 month 2 weeks ago
加入:2019-05-03所
Hi dialog

Hi dialog

Thanks for the suggestion, i have tried this approach

" Another possible solution might be to re-configure the P2_4 to ADC every time you want to use the ADC peripheral block. After using it to capture the ADC, you should configure it back to SWCLK. "

and i m able to program via JTAG ,, when i disable the debugger, but my ADC value read is zero,,,, i dont know now why ADC still not working,,

all other ADCs are working fine.

Is there any other setting i need to do for ADC to work on this pin P2_4?

PM_Dialog
Offline
Last seen:21 hours 15 min ago
工作人员
加入:2018-02-08 11:03
Hi mahmed106,

Hi mahmed106,

Thanks for following my approach. All you need to do is to disable the debugger either in the system initialization or before using the P2_4 as an ADC pin (of course reconfigure it first as suggested). You should not do any special configuration for the P2_4. Could you please try my first approach and disable the debugger in the system initialization (before the call of the periph_init() ? After that, you should configure the P2_4 and a ADC pin in the periph_init().

Thanks, PM_Dialog

mahmed106
Offline
Last seen:1 month 2 weeks ago
加入:2019-05-03所
Yes i have done exactly you

Yes i have done exactly you mentioned ,., i have disabled debugger before the periph init and in periph init i have made this pin as ADC (pulldown config)
Still this adc is not working ,, other ADCs are working fine.

PM_Dialog
Offline
Last seen:21 hours 15 min ago
工作人员
加入:2018-02-08 11:03
Hi mahmed106,

Hi mahmed106,

So, if the debugger is disabled, only the P2_4 is not working as an ADC pin? Could you please share the P2_4 configuration and how you are using the ADC adapter?

Thanks, PM_Dialog