Skip to content

PR 647 review #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Sep 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 10 additions & 7 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1037,34 +1037,36 @@ Sparky.menu.upload_method.dfuMethod.upload.tool=stm32CubeProg
################################################################################
# LoRa boards

LoRa.name=LoRaBoards
LoRa.name=LoRa boards

LoRa.build.vid=0x0483
LoRa.build.core=arduino
LoRa.build.board=RAK
LoRa.build.mcu=cortex-m3
LoRa.build.series=STM32L1xx
LoRa.build.cmsis_lib_gcc=arm_cortexM3l_math
LoRa.build.board=LoRa
LoRa.build.extra_flags=-D{build.product_line} {build.enable_usb} {build.xSerial}

# RAK811_TRACKER board
LoRa.menu.pnum.RAK811_TRACKER=RAK811 LoRa Tracker (16kb RAM)
LoRa.menu.pnum.RAK811_TRACKER.upload.maximum_data_size=16384
LoRa.menu.pnum.RAK811_TRACKER.upload.maximum_size=131072
LoRa.menu.pnum.RAK811_TRACKER.build.mcu=cortex-m3
LoRa.menu.pnum.RAK811_TRACKER.build.board=RAK811_TRACKER
LoRa.menu.pnum.RAK811_TRACKER.build.series=STM32L1xx
LoRa.menu.pnum.RAK811_TRACKER.build.product_line=STM32L151xB
LoRa.menu.pnum.RAK811_TRACKER.build.variant=RAK811_TRACKER
LoRa.menu.pnum.RAK811_TRACKER.build.cmsis_lib_gcc=arm_cortexM3l_math

LoRa.menu.pnum.RAK811_TRACKERA=RAK811 LoRa Tracker (32kb RAM)
LoRa.menu.pnum.RAK811_TRACKERA.upload.maximum_data_size=32768
LoRa.menu.pnum.RAK811_TRACKERA.upload.maximum_size=131072
LoRa.menu.pnum.RAK811_TRACKERA.build.mcu=cortex-m3
LoRa.menu.pnum.RAK811_TRACKERA.build.board=RAK811_TRACKERA
LoRa.menu.pnum.RAK811_TRACKERA.build.series=STM32L1xx
LoRa.menu.pnum.RAK811_TRACKERA.build.product_line=STM32L151xBA
LoRa.menu.pnum.RAK811_TRACKERA.build.variant=RAK811_TRACKER
LoRa.menu.pnum.RAK811_TRACKERA.build.cmsis_lib_gcc=arm_cortexM3l_math

# RHF76_052 board
LoRa.menu.pnum.RHF76_052=RHF76_052
LoRa.menu.pnum.RHF76_052.node=NODE_RHF76_052
LoRa.menu.pnum.RHF76_052=RHF76 052
LoRa.menu.pnum.RHF76_052.upload.maximum_size=65536
LoRa.menu.pnum.RHF76_052.upload.maximum_data_size=8192
LoRa.menu.pnum.RHF76_052.build.mcu=cortex-m0plus
Expand Down Expand Up @@ -1975,3 +1977,4 @@ Midatronics.menu.rtlib.nanofs.build.flags.ldspecs=--specs=nano.specs -u _scanf_f
Midatronics.menu.rtlib.nanofps=Newlib Nano + Float Printf/Scanf
Midatronics.menu.rtlib.nanofps.build.flags.ldspecs=--specs=nano.specs -u _printf_float -u _scanf_float
Midatronics.menu.rtlib.full=Newlib Standard
Midatronics.menu.rtlib.full.build.flags.ldspecs=
70 changes: 25 additions & 45 deletions variants/RHF76_052/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,24 @@
extern "C" {
#endif

// Pin number
// This array allows to wrap Arduino pin number(Dx or x)
// to STM32 PinName (PX_n)
const PinName digitalPin[] = {
PA_1, //D0 - RFSW0
PA_2, //D1 - RFSW1
PA_4, //D2 - NSS
PA_5, //D3 - CLK
PA_6, //D4 - MISO
PA_7, //D5 - MOSI
PB_0, //D6 - DIO2
PB_1, //D7 - DIO3
PB_2, //D8 - DIO1
PB_4, //D9 - Status LED trigger, connect to an external LED to show status of LoRaWAN processing
PB_5, //D10 - Status LED trigger, connect to an external LED, Reserved
PA_1, //D0 - RFSW0
PA_2, //D1 - RFSW1
PA_4, //D2 - NSS
PA_5, //D3 - CLK
PA_6, //D4 - MISO
PA_7, //D5 - MOSI
PB_0, //D6 - DIO2
PB_1, //D7 - DIO3
PB_2, //D8 - DIO1
PB_4, //D9 - Status LED trigger, connect to an external LED to show status of LoRaWAN processing
PB_5, //D10 - Status LED trigger, connect to an external LED, Reserved
PB_10, //D11 - DIO0
PB_11, //D12 - NRST
PC_0, //D13
PB_6, //D14 - UART_TX
PC_0, //D13
PB_6, //D14 - UART_TX
PB_7, //D15 - UART_RX
PA_9, //D16 - UART_TX
PA_9, //D16 - UART_TX
PA_10 //D17 - UART_RX
};

Expand All @@ -58,57 +55,40 @@ extern "C" {
/**
* @brief System Clock Configuration
* The system Clock is configured as follow :
* System Clock source = PLL (HSI)
* SYSCLK(Hz) = 32000000
* HCLK(Hz) = 32000000
* AHB Prescaler = 1
* APB1 Prescaler = 1
* APB2 Prescaler = 1
* HSE Frequency(Hz) = 8000000
* HSI Frequency(Hz) = 16000000
* PLLMUL = 8
* PLLDIV = 2
* Flash Latency(WS) = 1
* @retval None
*/
WEAK void SystemClock_Config(void)
{
RCC_OscInitTypeDef RCC_OscInitStruct = {};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {0};
RCC_PeriphCLKInitTypeDef PeriphClkInit = {0};
RCC_ClkInitTypeDef RCC_ClkInitStruct = {};
RCC_PeriphCLKInitTypeDef PeriphClkInit = {};

/* Configure the main internal regulator output voltage
*/
/* Configure the main internal regulator output voltage */
__HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
/* Initializes the CPU, AHB and APB busses clocks
*/
/* Initializes the CPU, AHB and APB busses clocks */
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_MSI;
RCC_OscInitStruct.MSIState = RCC_MSI_ON;
RCC_OscInitStruct.MSICalibrationValue = 0;
RCC_OscInitStruct.MSIClockRange = RCC_MSIRANGE_5;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_NONE;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK) {
Error_Handler();
}
/** Initializes the CPU, AHB and APB busses clocks
*/
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
|RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
/* Initializes the CPU, AHB and APB busses clocks */
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_MSI;
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV1;
RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1;

if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK)
{
if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_0) != HAL_OK) {
Error_Handler();
}
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1|RCC_PERIPHCLK_USART2;
PeriphClkInit.PeriphClockSelection = RCC_PERIPHCLK_USART1 | RCC_PERIPHCLK_USART2;
PeriphClkInit.Usart1ClockSelection = RCC_USART1CLKSOURCE_PCLK2;
PeriphClkInit.Usart2ClockSelection = RCC_USART2CLKSOURCE_PCLK1;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK)
{
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInit) != HAL_OK) {
Error_Handler();
}
}
Expand Down
18 changes: 6 additions & 12 deletions variants/RHF76_052/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,26 @@ extern "C" {

#define PA1 0
#define PA2 1
#define PA4 2
#define PA4 2
#define PA5 3
#define PA6 4
#define PA7 5
#define PB0 6
#define PB0 6
#define PB1 7
#define PB2 8
#define PB4 9
#define PB5 10
#define PB10 11
#define PB11 12
#define PC0 13 // A0 Dummie
#define PB10 11
#define PB11 12
#define PC0 13
#define PB6 14 // TX Module LoRa
#define PB7 15 // RX
#define PA9 16 // TX Boot
#define PA10 17 // RX Boot
#define PA10 17 // RX Boot


// This must be a literal
#define NUM_DIGITAL_PINS 18
// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
#define NUM_ANALOG_INPUTS 1
#define NUM_ANALOG_FIRST 1

// On-board LED pin number
#define LED_BUILTIN PB4
Expand All @@ -70,9 +67,6 @@ extern "C" {
#define PIN_SERIAL_RX PB7
#define PIN_SERIAL_TX PB6

/* Extra HAL modules */
#define HAL_ADC_MODULE_DISABLED

#ifdef __cplusplus
} // extern "C"
#endif
Expand Down