EFM32-chip peripherals-SWD interface multiplexing of GPIO

Source: Internet
Author: User

The debug interface of efm32 uses the SWD interface, namely the two-wire JTAG interface. The two signal lines are swclk and swdio respectively. Swclk is an internal drop-down by default, and swdio is an internal pull-up by default. If you want to reuse these two ports into gpio ports, You need to modify the gpio-> route register. Disable the reuse function.

Routine:

Disable the SWD interface and set it to the gpio output function.

# Include <stdint. h>
# Include <stdbool. h>
# Include "efm32.h"
# Include "efm32_chip.h"
# Include "efm32_cmu.h"
# Include "efm32_gpio.h"

/*************************************** ***********************************//**
* @ Brief Main Function
**************************************** *************************************/
Int main (void)
{
/* Chip errata */
Chip_init ();

Cmu_clockenable (cmuclock_gpio, true );

Unsigned long ulDelay = 30000000;
While (ulDelay --);

GPIO_DbgSWDClkEnable (false );

GPIO_DbgSWDIOEnable (false );

GPIO_PinModeSet (gpioPortF, 0, gpioModePushPull, 1 );
GPIO_PinModeSet (gpioPortF, 1, gpioModePushPull, 1 );

/* Infinite blink loop */
While (1)
{
Unsigned long ulcc = 5000;
While (ulcc --);
GPIO_PinOutToggle (gpioPortF, 0 );
GPIO_PinOutToggle (gpioPortF, 1 );
}
}

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.