Added macro allowing to enable the SWD debugging interface on MDx devices (TG-272 #closed)

replace/e3a26d8ab32bc7d8bcb6955969c5f65e64604469
Silvano Seva 2021-08-12 19:43:12 +02:00
rodzic 07e1f28f79
commit 379b487f64
4 zmienionych plików z 37 dodań i 3 usunięć

Wyświetl plik

@ -5,6 +5,12 @@ project('OpenRTX', ['c', 'cpp'],
version : '0.3.1',
default_options : ['warning_level=3'])
##
## Optional defines, common to all souces (e.g. to enable debugging)
##
def = { }
##
## ----------------- Platform-independent source files -------------------------
##
@ -71,7 +77,7 @@ rtos_inc = ['lib/miosix-kernel',
src = openrtx_src + minmea_src
inc = openrtx_inc + rtos_inc + minmea_inc + qdec_inc
def = {'DONT_USE_CMSIS_INIT': ''}
def = def + {'DONT_USE_CMSIS_INIT': ''}
## Add git commit or tag to print in OpenRTX
r = run_command('git', 'describe', '--tags', '--dirty')

Wyświetl plik

@ -28,14 +28,18 @@ void audio_init()
gpio_setMode(SPK_MUTE, OUTPUT);
#ifndef PLATFORM_MD9600
gpio_setMode(AUDIO_AMP_EN, OUTPUT);
#ifndef MDx_ENABLE_SWD
gpio_setMode(MIC_PWR, OUTPUT);
#endif
#endif
gpio_setPin(SPK_MUTE); /* Speaker muted */
#ifndef PLATFORM_MD9600
gpio_clearPin(AUDIO_AMP_EN); /* Audio PA off */
#ifndef MDx_ENABLE_SWD
gpio_clearPin(MIC_PWR); /* Mic preamp. off */
#endif
#endif
}
void audio_terminate()
@ -43,20 +47,22 @@ void audio_terminate()
gpio_setPin(SPK_MUTE); /* Speaker muted */
#ifndef PLATFORM_MD9600
gpio_clearPin(AUDIO_AMP_EN); /* Audio PA off */
#ifndef MDx_ENABLE_SWD
gpio_clearPin(MIC_PWR); /* Mic preamp. off */
#endif
#endif
}
void audio_enableMic()
{
#ifndef PLATFORM_MD9600
#if !defined(PLATFORM_MD9600) && !defined(MDx_ENABLE_SWD)
gpio_setPin(MIC_PWR);
#endif
}
void audio_disableMic()
{
#ifndef PLATFORM_MD9600
#if !defined(PLATFORM_MD9600) && !defined(MDx_ENABLE_SWD)
gpio_clearPin(MIC_PWR);
#endif
}

Wyświetl plik

@ -61,17 +61,23 @@ void _setBandwidth(const enum bandwidth bw)
switch(bw)
{
case BW_12_5:
#ifndef MDx_ENABLE_SWD
gpio_clearPin(WN_SW);
#endif
C5000.setModFactor(0x1E);
break;
case BW_20:
#ifndef MDx_ENABLE_SWD
gpio_setPin(WN_SW);
#endif
C5000.setModFactor(0x30);
break;
case BW_25:
#ifndef MDx_ENABLE_SWD
gpio_setPin(WN_SW);
#endif
C5000.setModFactor(0x3C);
break;
@ -97,7 +103,9 @@ void radio_init(const rtxStatus_t *rtxState)
gpio_setMode(PLL_PWR, OUTPUT);
gpio_setMode(VCOVCC_SW, OUTPUT);
gpio_setMode(DMR_SW, OUTPUT);
#ifndef MDx_ENABLE_SWD
gpio_setMode(WN_SW, OUTPUT);
#endif
gpio_setMode(FM_SW, OUTPUT);
gpio_setMode(RF_APC_SW, OUTPUT);
gpio_setMode(TX_STG_EN, OUTPUT);
@ -108,7 +116,9 @@ void radio_init(const rtxStatus_t *rtxState)
gpio_clearPin(PLL_PWR); // PLL off
gpio_setPin(VCOVCC_SW); // VCOVCC high enables RX VCO, TX VCO if low
#ifndef MDx_ENABLE_SWD
gpio_setPin(WN_SW); // 25kHz bandwidth
#endif
gpio_clearPin(DMR_SW); // Disconnect HR_C5000 input IF signal and audio out
gpio_clearPin(FM_SW); // Disconnect analog FM audio path
gpio_clearPin(RF_APC_SW); // Disable TX power control

Wyświetl plik

@ -52,6 +52,18 @@ void IRQbspInit()
GPIOE->OSPEEDR=0xaaaaaaaa;
GPIOH->OSPEEDR=0xaaaaaaaa;
/*
* Enable SWD interface on PA13 and PA14 (Tytera's bootloader disables this
* functionality).
* NOTE: these pins are used also for other functions (MIC power and wide/
* narrow FM reception), thus they cannot be always used for debugging!
*/
#ifdef MDx_ENABLE_SWD
GPIOA->MODER &= ~0x3C000000; // Clear current setting
GPIOA->MODER |= 0x28000000; // Put back to alternate function
GPIOA->AFR[1] &= ~0x0FF00000; // SWD is AF0
#endif
#ifdef MD3x0_ENABLE_DBG
usart3_init(115200);
usart3_IRQwrite("starting...\r\n");