Hi Dialog
I would like to use P2_4 as GPIO, but found that the pin always stay low no matter what I config as GPIO or PWM output pin. From my understanding, the SWCLK function of P2_4 should be
release after user's code starts. I do not found any setting in P2_4 for other using. Please tell me how to implement the GPIO function of P2_4.
thanks for your help.
Device:
Hi nigelyang,
As you mentioned correctly in your thread, the P2_4 is used for the SWCLK, and it is by default enabled by the boot loader. According to DA14680 datasheet, the P2_4 is pull-down enabled during and after reset, please check the datasheet for getting more information. Although, after the booting procedure, you can configurate it as a GPIO or as a PWM output, but you have to disable the debugger first. Please, check the DEBUGGER_ENABLE of the Table 182: SYS_CTRL_REG (0x50000012) from the datasheet If it is not set, the SWDIO and SW_CLK can be used as gpio ports. The debugger is by default enable it from the bootloader, so DEBUGGER_ENABLE is equal to 1. That you have to do in order to disable the debugger is to set it into zero. You can do it by using the REG_CLR_BIT definition of the sdk_def.h header file under this SDK path:sdk/bsp_include/ sdk_def.h.
REG_CLR_BIT(CRG_TOP, DEBUGGER_ENABLE , 0) // disable the debugger
Also, could you please clarify if you are using a custom board or our DA14680 development kit? In case you are using our Dev-Kit, you should displace the jumper of the header J14 in order to disable the JTAG connection. Please, try my recommendation and let me know if you have any other issues.
Thanks, PM_Dialog
HI dialog
I m having the same issue,, that i m not able to use ADC on this pin,,
But if i diasble debugger mode ,, where in the code should i use this command?
REG_CLR_BIT(CRG_TOP, DEBUGGER_ENABLE , 0) // disable the debugger
Can you please help me in this regard?
And if i disable the debugger by this bit ,, will i be able to program the SOC again via SWD pins or not?
Hi mahmed106,
谢谢你的问题tion. I’ve already replied you in your new forum thread. Thanks for raising a new forum ticket.
https://support.dialog-semiconductor.com/forums/post/dialog-smartbond-bluetooth-low-energy-%E2%80%93-software/use-da14681-swd-pins-adc#comment-27970
Thanks, PM_Dialog