Initial commit for Duplex board

pull/107/head
Abad-Vera 7 years ago
parent e9b89208cc
commit 3cdeb26aa0

@ -21,9 +21,9 @@
// Select one board (STM32F103 based boards) // Select one board (STM32F103 based boards)
// 1) ZUMspot RPi or ZUMspot USB: // 1) ZUMspot RPi or ZUMspot USB:
// #define ZUMSPOT_ADF7021 #define ZUMSPOT_ADF7021
// 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103: // 2) Libre Kit board or any homebrew hotspot with modified RF7021SE and Blue Pill STM32F103:
#define LIBRE_KIT_ADF7021 // #define LIBRE_KIT_ADF7021
// 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET) // 3) MMDVM_HS_Hat revisions 1.1, 1.2 and 1.4 (DB9MAT & DF2ET)
// #define MMDVM_HS_HAT_REV12 // #define MMDVM_HS_HAT_REV12
// 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN) // 4) MMDVM_HS_Dual_Hat revisions 1.0 (DB9MAT & DF2ET & DO7EN)
@ -37,7 +37,7 @@
#define ENABLE_ADF7021 #define ENABLE_ADF7021
// Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only): // Enable full duplex support with dual ADF7021 (valid for homebrew hotspots only):
// #define DUPLEX #define DUPLEX
// TCXO of the ADF7021 // TCXO of the ADF7021
// For 14.7456 MHz: // For 14.7456 MHz:
@ -50,14 +50,14 @@
#define AD7021_GAIN_AUTO #define AD7021_GAIN_AUTO
// AGC automatic with high LNA linearity: // AGC automatic with high LNA linearity:
// #define AD7021_GAIN_AUTO_LIN // #define AD7021_GAIN_AUTO_LIN
// AGC OFF, lowest gain: // AGC OFF, lowest gain:
// #define AD7021_GAIN_LOW // #define AD7021_GAIN_LOW
// AGC OFF, highest gain: // AGC OFF, highest gain:
// #define AD7021_GAIN_HIGH // #define AD7021_GAIN_HIGH
// Host communication selection: // Host communication selection:
// #define STM32_USART1_HOST #define STM32_USART1_HOST
#define STM32_USB_HOST // #define STM32_USB_HOST
// #define STM32_I2C_HOST // #define STM32_I2C_HOST
// I2C host address: // I2C host address:
@ -67,7 +67,7 @@
#define ENABLE_SCAN_MODE #define ENABLE_SCAN_MODE
// Send RSSI value: // Send RSSI value:
// #define SEND_RSSI_DATA #define SEND_RSSI_DATA
// Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi): // Enable Nextion LCD serial port repeater on USART2 (ZUMspot Libre Kit and ZUMspot RPi):
#define SERIAL_REPEATER #define SERIAL_REPEATER
@ -82,7 +82,7 @@
// Disable mode LEDs blink during scan mode: // Disable mode LEDs blink during scan mode:
// #define QUIET_MODE_LEDS // #define QUIET_MODE_LEDS
// Engage a constant or descreet Service LED mode once repeater is running // Engage a constant or descreet Service LED mode once repeater is running
// #define CONSTANT_SRV_LED // #define CONSTANT_SRV_LED
// #define CONSTANT_SRV_LED_INVERTED // #define CONSTANT_SRV_LED_INVERTED
// #define DISCREET_SRV_LED // #define DISCREET_SRV_LED
@ -95,7 +95,7 @@
// #define USE_ALTERNATE_POCSAG_LEDS // #define USE_ALTERNATE_POCSAG_LEDS
// Enable for RPi 3B+, USB mode // Enable for RPi 3B+, USB mode
#define LONG_USB_RESET // #define LONG_USB_RESET
// Enable modem debug messages // Enable modem debug messages
#define ENABLE_DEBUG #define ENABLE_DEBUG

@ -1,8 +1,8 @@
/* /*
* Copyright (C) 2016 by Jim McLaughlin KI6ZUM * Copyright (C) 2016 by Jim McLaughlin KI6ZUM
* Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU * Copyright (C) 2016,2017,2018 by Andy Uribe CA6JAU
* Copyright (C) 2017 by Danilo DB4PLE * Copyright (C) 2017 by Danilo DB4PLE
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
@ -115,6 +115,9 @@
#define PIN_RXD GPIO_Pin_4 #define PIN_RXD GPIO_Pin_4
#define PORT_RXD GPIOB #define PORT_RXD GPIOB
#define PIN_RXD2 GPIO_Pin_4
#define PORT_RXD2 GPIOA
// TXD used in SPI Data mode of ADF7021 // TXD used in SPI Data mode of ADF7021
// TXD is TxRxCLK of ADF7021, standard TX/RX data interface // TXD is TxRxCLK of ADF7021, standard TX/RX data interface
#define PIN_TXD GPIO_Pin_3 #define PIN_TXD GPIO_Pin_3
@ -122,6 +125,12 @@
#define PIN_TXD_INT GPIO_PinSource3 #define PIN_TXD_INT GPIO_PinSource3
#define PORT_TXD_INT GPIO_PortSourceGPIOB #define PORT_TXD_INT GPIO_PortSourceGPIOB
// TXD2 is TxRxCLK of the second ADF7021, standard TX/RX data interface
#define PIN_TXD2 GPIO_Pin_8
#define PORT_TXD2 GPIOA
#define PIN_TXD2_INT GPIO_PinSource8
#define PORT_TXD2_INT GPIO_PortSourceGPIOA
// CLKOUT used in SPI Data mode of ADF7021 // CLKOUT used in SPI Data mode of ADF7021
#define PIN_CLKOUT GPIO_Pin_15 #define PIN_CLKOUT GPIO_Pin_15
#define PORT_CLKOUT GPIOA #define PORT_CLKOUT GPIOA
@ -131,8 +140,8 @@
#define PIN_LED GPIO_Pin_13 #define PIN_LED GPIO_Pin_13
#define PORT_LED GPIOC #define PORT_LED GPIOC
#define PIN_DEB GPIO_Pin_9 #define PIN_DEB GPIO_Pin_7
#define PORT_DEB GPIOB #define PORT_DEB GPIOA
#define PIN_DSTAR_LED GPIO_Pin_12 #define PIN_DSTAR_LED GPIO_Pin_12
#define PORT_DSTAR_LED GPIOB #define PORT_DSTAR_LED GPIOB
@ -280,9 +289,9 @@ extern "C" {
#if defined(DUPLEX) #if defined(DUPLEX)
void EXTI9_5_IRQHandler(void) { void EXTI9_5_IRQHandler(void) {
if(EXTI_GetITStatus(EXTI_Line5)!=RESET) { if(EXTI_GetITStatus(EXTI_Line8)!=RESET) {
io.interrupt2(); io.interrupt2();
EXTI_ClearITPendingBit(EXTI_Line5); EXTI_ClearITPendingBit(EXTI_Line8);
} }
} }
#endif #endif
@ -301,7 +310,7 @@ void CIO::Init()
#endif #endif
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA | RCC_APB2Periph_GPIOB | RCC_APB2Periph_GPIOC | RCC_APB2Periph_AFIO, ENABLE);
#if defined(PI_HAT_7021_REV_02) #if defined(PI_HAT_7021_REV_02)
GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE); GPIO_PinRemapConfig(GPIO_Remap_SWJ_Disable, ENABLE);
#elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11) #elif defined(ZUMSPOT_ADF7021) || defined(LIBRE_KIT_ADF7021) || defined(MMDVM_HS_HAT_REV12) || defined(MMDVM_HS_DUAL_HAT_REV10) || defined(NANO_HOTSPOT) || defined(NANO_DV_REV11)
@ -343,7 +352,7 @@ void CIO::Init()
GPIO_InitStruct.GPIO_Pin = PIN_SDATA; GPIO_InitStruct.GPIO_Pin = PIN_SDATA;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(PORT_SDATA, &GPIO_InitStruct); GPIO_Init(PORT_SDATA, &GPIO_InitStruct);
// Pin SREAD // Pin SREAD
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Pin = PIN_SREAD; GPIO_InitStruct.GPIO_Pin = PIN_SREAD;
@ -355,14 +364,14 @@ void CIO::Init()
GPIO_InitStruct.GPIO_Pin = PIN_SLE; GPIO_InitStruct.GPIO_Pin = PIN_SLE;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(PORT_SLE, &GPIO_InitStruct); GPIO_Init(PORT_SLE, &GPIO_InitStruct);
#if defined(DUPLEX) #if defined(DUPLEX)
// Pin SLE2 // Pin SLE2
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Pin = PIN_SLE2; GPIO_InitStruct.GPIO_Pin = PIN_SLE2;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(PORT_SLE2, &GPIO_InitStruct); GPIO_Init(PORT_SLE2, &GPIO_InitStruct);
// Pin RXD2 // Pin RXD2
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Pin = PIN_RXD2; GPIO_InitStruct.GPIO_Pin = PIN_RXD2;
@ -393,6 +402,7 @@ void CIO::Init()
#endif #endif
GPIO_Init(PORT_TXD, &GPIO_InitStruct); GPIO_Init(PORT_TXD, &GPIO_InitStruct);
#if defined(DUPLEX) #if defined(DUPLEX)
GPIO_InitStruct.GPIO_Pin = PIN_TXD2;
GPIO_Init(PORT_TXD2, &GPIO_InitStruct); GPIO_Init(PORT_TXD2, &GPIO_InitStruct);
#endif #endif
@ -403,7 +413,7 @@ void CIO::Init()
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(PORT_CLKOUT, &GPIO_InitStruct); GPIO_Init(PORT_CLKOUT, &GPIO_InitStruct);
#endif #endif
// Pin LED // Pin LED
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Pin = PIN_LED; GPIO_InitStruct.GPIO_Pin = PIN_LED;
@ -416,37 +426,37 @@ void CIO::Init()
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(PORT_DEB, &GPIO_InitStruct); GPIO_Init(PORT_DEB, &GPIO_InitStruct);
// D-Star LED // D-Star LED
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Pin = PIN_DSTAR_LED; GPIO_InitStruct.GPIO_Pin = PIN_DSTAR_LED;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(PORT_DSTAR_LED, &GPIO_InitStruct); GPIO_Init(PORT_DSTAR_LED, &GPIO_InitStruct);
// DMR LED // DMR LED
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Pin = PIN_DMR_LED; GPIO_InitStruct.GPIO_Pin = PIN_DMR_LED;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(PORT_DMR_LED, &GPIO_InitStruct); GPIO_Init(PORT_DMR_LED, &GPIO_InitStruct);
// YSF LED // YSF LED
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Pin = PIN_YSF_LED; GPIO_InitStruct.GPIO_Pin = PIN_YSF_LED;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(PORT_YSF_LED, &GPIO_InitStruct); GPIO_Init(PORT_YSF_LED, &GPIO_InitStruct);
// P25 LED // P25 LED
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Pin = PIN_P25_LED; GPIO_InitStruct.GPIO_Pin = PIN_P25_LED;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(PORT_P25_LED, &GPIO_InitStruct); GPIO_Init(PORT_P25_LED, &GPIO_InitStruct);
// NXDN LED // NXDN LED
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Pin = PIN_NXDN_LED; GPIO_InitStruct.GPIO_Pin = PIN_NXDN_LED;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(PORT_NXDN_LED, &GPIO_InitStruct); GPIO_Init(PORT_NXDN_LED, &GPIO_InitStruct);
// POCSAG LED // POCSAG LED
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Pin = PIN_POCSAG_LED; GPIO_InitStruct.GPIO_Pin = PIN_POCSAG_LED;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
@ -458,7 +468,7 @@ void CIO::Init()
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(PORT_PTT_LED, &GPIO_InitStruct); GPIO_Init(PORT_PTT_LED, &GPIO_InitStruct);
// COS LED // COS LED
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Pin = PIN_COS_LED; GPIO_InitStruct.GPIO_Pin = PIN_COS_LED;
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
@ -496,7 +506,7 @@ void CIO::Init()
// Connect EXTI5 Line // Connect EXTI5 Line
GPIO_EXTILineConfig(PORT_TXD2_INT, PIN_TXD2_INT); GPIO_EXTILineConfig(PORT_TXD2_INT, PIN_TXD2_INT);
// Configure EXT5 line // Configure EXT5 line
EXTI_InitStructure2.EXTI_Line = EXTI_Line5; EXTI_InitStructure2.EXTI_Line = EXTI_Line8;
#endif #endif
#endif #endif
@ -505,7 +515,7 @@ void CIO::Init()
EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling; EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising_Falling;
EXTI_InitStructure.EXTI_LineCmd = ENABLE; EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure); EXTI_Init(&EXTI_InitStructure);
#if defined(DUPLEX) #if defined(DUPLEX)
EXTI_InitStructure2.EXTI_Mode = EXTI_Mode_Interrupt; EXTI_InitStructure2.EXTI_Mode = EXTI_Mode_Interrupt;
EXTI_InitStructure2.EXTI_Trigger = EXTI_Trigger_Rising; EXTI_InitStructure2.EXTI_Trigger = EXTI_Trigger_Rising;
@ -517,7 +527,7 @@ void CIO::Init()
void CIO::startInt() void CIO::startInt()
{ {
NVIC_InitTypeDef NVIC_InitStructure; NVIC_InitTypeDef NVIC_InitStructure;
#if defined(DUPLEX) #if defined(DUPLEX)
NVIC_InitTypeDef NVIC_InitStructure2; NVIC_InitTypeDef NVIC_InitStructure2;
#endif #endif
@ -546,7 +556,7 @@ void CIO::startInt()
NVIC_InitStructure.NVIC_IRQChannelSubPriority = 15; NVIC_InitStructure.NVIC_IRQChannelSubPriority = 15;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE; NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure); NVIC_Init(&NVIC_InitStructure);
#if defined(DUPLEX) #if defined(DUPLEX)
NVIC_InitStructure2.NVIC_IRQChannelPreemptionPriority = 1; NVIC_InitStructure2.NVIC_IRQChannelPreemptionPriority = 1;
NVIC_InitStructure2.NVIC_IRQChannelSubPriority = 15; NVIC_InitStructure2.NVIC_IRQChannelSubPriority = 15;
@ -557,18 +567,18 @@ void CIO::startInt()
#if defined(BIDIR_DATA_PIN) #if defined(BIDIR_DATA_PIN)
// RXD pin is bidirectional in standard interfaces // RXD pin is bidirectional in standard interfaces
void CIO::Data_dir_out(bool dir) void CIO::Data_dir_out(bool dir)
{ {
GPIO_InitTypeDef GPIO_InitStruct; GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStruct.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStruct.GPIO_Pin = PIN_RXD; GPIO_InitStruct.GPIO_Pin = PIN_RXD;
if(dir) if(dir)
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_Out_PP;
else else
GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_InitStruct.GPIO_Mode = GPIO_Mode_IN_FLOATING;
GPIO_Init(PORT_RXD, &GPIO_InitStruct); GPIO_Init(PORT_RXD, &GPIO_InitStruct);
} }
#endif #endif

Loading…
Cancel
Save

Powered by TurnKey Linux.