This commit is contained in:
Christoph Haberer 2017-04-26 12:52:56 +02:00
commit 65b0ded7b1
36 changed files with 755 additions and 344 deletions

View File

@ -177,7 +177,7 @@ BLACK_F407VE.menu.serial.SerialUART1.build.extra_flags_serial=-DMENU_SERIAL=Seri
################################################################################
# NUCLEO 64 board
NUCLEO_64.name=Nucleo-64 [BOARD PIN NUMBERS NOT WORKING YET!] (Select board from submenu)
NUCLEO_64.name=Nucleo-64 boards
NUCLEO_64.vid.0=0x0483
NUCLEO_64.pid.0=0x5711

View File

@ -137,7 +137,7 @@ size_t SerialUART::write(const uint8_t c) {
txBuffer[txEnd % BUFFER_SIZE] = c;
txEnd++;
if (txEnd == txStart + 1) {
if (txEnd % BUFFER_SIZE == (txStart + 1) % BUFFER_SIZE) {
HAL_UART_Transmit_IT(handle, &txBuffer[txStart % BUFFER_SIZE], 1);
}
return 1;

View File

@ -44,15 +44,22 @@ class SerialUART : public Stream {
#ifdef USART1
extern SerialUART SerialUART1;
#define Serial1 SerialUART1
#endif
#ifdef USART2
extern SerialUART SerialUART2;
#define Serial2 SerialUART2
#endif
#ifdef USART3
extern SerialUART SerialUART3;
#define Serial3 SerialUART3
#endif
#ifdef USART4
extern SerialUART SerialUART4;
#define Serial4 SerialUART4
#endif
#endif // _UART_CLASS_

View File

@ -2,7 +2,7 @@
#include "variant.h"
void stm32_gpio_clock(GPIO_TypeDef *port) {
void stm32GpioClock(GPIO_TypeDef *port) {
#ifdef GPIOA
if (port == GPIOA) __HAL_RCC_GPIOA_CLK_ENABLE();
@ -46,7 +46,7 @@ void pinMode(uint8_t pin, uint8_t mode) {
(*stm32_pwm_disable_callback)(port_pin.port, port_pin.pin_mask);
}
stm32_gpio_clock(port_pin.port);
stm32GpioClock(port_pin.port);
GPIO_InitTypeDef init;

View File

@ -38,7 +38,7 @@ extern const stm32_port_pin_type variant_pin_list[NUM_PINS];
/**
* Start clock for the fedined port
*/
void stm32_gpio_clock_enable(GPIO_TypeDef *port);
void stm32GpioClockEnable(GPIO_TypeDef *port);
/**
* If PWM is used at least once, this method is set to the PWM disable function in stm32_PWM.c

View File

@ -51,6 +51,16 @@ void stm32AfSPIInit(const SPI_TypeDef *instance,
}
void stm32AfI2SInit(const SPI_TypeDef *instance,
GPIO_TypeDef *sdPort, uint32_t sdPin,
GPIO_TypeDef *wsPort, uint32_t wsPin,
GPIO_TypeDef *ckPort, uint32_t ckPin) {
stm32AfInit(chip_af_i2s_sd, sizeof(chip_af_i2s_sd) / sizeof(chip_af_i2s_sd[0]), instance, sdPort, sdPin, GPIO_MODE_AF_PP, GPIO_NOPULL);
stm32AfInit(chip_af_i2s_ws, sizeof(chip_af_i2s_ws) / sizeof(chip_af_i2s_ws[0]), instance, wsPort, wsPin, GPIO_MODE_AF_PP, GPIO_NOPULL);
stm32AfInit(chip_af_i2s_ck, sizeof(chip_af_i2s_ck) / sizeof(chip_af_i2s_ck[0]), instance, ckPort, ckPin, GPIO_MODE_AF_PP, GPIO_NOPULL);
}
void stm32AfI2CInit(const I2C_TypeDef *instance,
GPIO_TypeDef *sdaPort, uint32_t sdaPin,
GPIO_TypeDef *sclPort, uint32_t sclPin) {

View File

@ -51,6 +51,11 @@ void stm32AfSPIInit(const SPI_TypeDef *instance,
GPIO_TypeDef *misoPort, uint32_t misoPin,
GPIO_TypeDef *sckPort, uint32_t sckPin);
void stm32AfI2SInit(const SPI_TypeDef *instance,
GPIO_TypeDef *sdPort, uint32_t sdPin,
GPIO_TypeDef *wsPort, uint32_t wsPin,
GPIO_TypeDef *ckPort, uint32_t ckPin);
void stm32AfI2CInit(const I2C_TypeDef *instance,
GPIO_TypeDef *sdaPort, uint32_t sdaPin,
GPIO_TypeDef *sclPort, uint32_t sclPin);

View File

@ -22,7 +22,7 @@ void stm32AfInit(const stm32_af_pin_list_type list[], int size, const void *inst
if (port == NULL) {
port = stm32AfGetDefault(list, size, instance, &pin);
}
stm32_gpio_clock(port);
stm32GpioClock(port);
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Pin = pin;

View File

@ -21,7 +21,7 @@ void stm32AfInit(const stm32_af_pin_list_type list[], int size, const void *inst
if (port == NULL) {
port = stm32AfDefault(list, size, instance, &pin);
}
stm32_gpio_clock(port);
stm32GpioClock(port);
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Pin = pin;

View File

@ -0,0 +1,94 @@
#include "stm32_gpio.h"
#define CHANGE 1
#define FALLING 2
#define RISING 3
typedef void (*stm32_exti_callback_func)();
#if defined(STM32F0) || defined(STM32L0)
const uint8_t exti_irq[] = {EXTI0_1_IRQn, EXTI0_1_IRQn, EXTI2_3_IRQn, EXTI2_3_IRQn, EXTI4_15_IRQn,
EXTI4_15_IRQn, EXTI4_15_IRQn, EXTI4_15_IRQn, EXTI4_15_IRQn, EXTI4_15_IRQn,
EXTI4_15_IRQn, EXTI4_15_IRQn, EXTI4_15_IRQn, EXTI4_15_IRQn, EXTI4_15_IRQn, EXTI4_15_IRQn};
#else
const uint8_t exti_irq[] = {EXTI0_IRQn, EXTI1_IRQn, EXTI2_IRQn, EXTI3_IRQn, EXTI4_IRQn,
EXTI9_5_IRQn, EXTI9_5_IRQn, EXTI9_5_IRQn, EXTI9_5_IRQn, EXTI9_5_IRQn,
EXTI15_10_IRQn, EXTI15_10_IRQn, EXTI15_10_IRQn, EXTI15_10_IRQn, EXTI15_10_IRQn, EXTI15_10_IRQn};
#endif
stm32_exti_callback_func callbacks[16];
void attachInterrupt(uint8_t pin, stm32_exti_callback_func callback, int mode) {
const stm32_port_pin_type port_pin = variant_pin_list[pin];
uint8_t irq = __builtin_ffs(port_pin.pin_mask) - 1;
callbacks[irq] = callback;
stm32GpioClock(port_pin.port);
GPIO_InitTypeDef GPIO_InitStruct;
GPIO_InitStruct.Pin = port_pin.pin_mask;
switch(mode) {
case RISING:
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
break;
case FALLING:
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
break;
case CHANGE:
default:
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
}
GPIO_InitStruct.Pull = GPIO_NOPULL;
HAL_GPIO_Init(port_pin.port, &GPIO_InitStruct);
HAL_NVIC_SetPriority(exti_irq[irq], 6, 0);
HAL_NVIC_EnableIRQ(exti_irq[irq]);
}
void detachInterrupt(uint8_t pin) {
callbacks[__builtin_ffs(variant_pin_list[pin].pin_mask) - 1] = NULL;
}
void EXTI0_IRQHandler(void) {
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_0);
}
void EXTI1_IRQHandler(void) {
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_1);
}
void EXTI2_IRQHandler(void) {
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_2);
}
void EXTI3_IRQHandler(void) {
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_3);
}
void EXTI4_IRQHandler(void) {
HAL_GPIO_EXTI_IRQHandler(GPIO_PIN_4);
}
void EXTI9_5_IRQHandler(void) {
for(uint32_t pin = GPIO_PIN_5; pin <= GPIO_PIN_9; pin=pin<<1) {
HAL_GPIO_EXTI_IRQHandler(pin);
}
}
void EXTI15_10_IRQHandler(void) {
for(uint32_t pin = GPIO_PIN_10; pin <= GPIO_PIN_15; pin=pin<<1) {
HAL_GPIO_EXTI_IRQHandler(pin);
}
}
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
stm32_exti_callback_func callback = callbacks[__builtin_ffs(GPIO_Pin) - 1];
if (callback != NULL) {
callback();
}
}

View File

@ -0,0 +1,104 @@
#include "I2S.h"
#include "stm32_gpio_af.h"
I2SClass::I2SClass(SPI_TypeDef *instance) {
handle.Instance = instance;
}
I2SClass::I2SClass(SPI_TypeDef *instance, uint8_t sd, uint8_t ws, uint8_t ck) {
handle.Instance = instance;
this->sdPort = variant_pin_list[sd].port;
this->sdPin = variant_pin_list[sd].pin_mask;
this->wsPort = variant_pin_list[ws].port;
this->wsPin = variant_pin_list[ws].pin_mask;
this->ckPort = variant_pin_list[ck].port;
this->ckPin = variant_pin_list[ck].pin_mask;
}
uint8_t I2SClass::begin(i2s_mode_t mode, uint32_t sampleRate, uint8_t bitsPerSample) {
#ifdef SPI1
if (handle.Instance == SPI1) __HAL_RCC_SPI1_CLK_ENABLE();
#endif
#ifdef SPI2
if (handle.Instance == SPI2) __HAL_RCC_SPI2_CLK_ENABLE();
#endif
#ifdef SPI3
if (handle.Instance == SPI3) __HAL_RCC_SPI3_CLK_ENABLE();
#endif
#ifdef SPI4
if (handle.Instance == SPI4) __HAL_RCC_SPI4_CLK_ENABLE();
#endif
#ifdef SPI5
if (handle.Instance == SPI5) __HAL_RCC_SPI5_CLK_ENABLE();
#endif
#ifdef SPI6
if (handle.Instance == SPI6) __HAL_RCC_SPI6_CLK_ENABLE();
#endif
stm32AfI2SInit(handle.Instance, sdPort, sdPin, wsPort, wsPin, ckPort, ckPin);
if (mode == I2S_PHILIPS_MODE) {
handle.Init.Standard = I2S_STANDARD_PHILIPS;
} else if (mode == I2S_LEFT_JUSTIFIED_MODE) {
handle.Init.Standard = I2S_STANDARD_LSB;
} else if (mode == I2S_RIGHT_JUSTIFIED_MODE) {
handle.Init.Standard = I2S_STANDARD_MSB;
} else {
return false;
}
handle.Init.Mode = I2S_MODE_MASTER_TX;
handle.Init.MCLKOutput = I2S_MCLKOUTPUT_DISABLE;
handle.Init.AudioFreq = I2S_AUDIOFREQ_44K;
handle.Init.CPOL = I2S_CPOL_LOW;
handle.Init.ClockSource = I2S_CLOCK_PLL;
handle.Init.FullDuplexMode = I2S_FULLDUPLEXMODE_DISABLE;
if (sampleRate >= 96000) {
handle.Init.AudioFreq = I2S_AUDIOFREQ_96K;
} else if (sampleRate >= 48000) {
handle.Init.AudioFreq = I2S_AUDIOFREQ_48K;
} else if (sampleRate >= 44000) {
handle.Init.AudioFreq = I2S_AUDIOFREQ_44K;
} else if (sampleRate >= 32000) {
handle.Init.AudioFreq = I2S_AUDIOFREQ_32K;
} else if (sampleRate >= 22000) {
handle.Init.AudioFreq = I2S_AUDIOFREQ_22K;
} else if (sampleRate >= 16000) {
handle.Init.AudioFreq = I2S_AUDIOFREQ_16K;
} else if (sampleRate >= 11000) {
handle.Init.AudioFreq = I2S_AUDIOFREQ_11K;
} else {
handle.Init.AudioFreq = I2S_AUDIOFREQ_8K;
}
if (bitsPerSample == 16) {
handle.Init.DataFormat = I2S_DATAFORMAT_16B;
} else if (bitsPerSample == 24) {
handle.Init.DataFormat = I2S_DATAFORMAT_24B;
} else if (bitsPerSample == 32) {
handle.Init.DataFormat = I2S_DATAFORMAT_32B;
} else {
return false;
}
return HAL_I2S_Init(&handle) == HAL_OK;
}
void I2SClass::write(uint16_t data) {
HAL_I2S_Transmit(&handle, &data, 1, 1000);
}
void I2SClass::write32(uint32_t data) {
HAL_I2S_Transmit(&handle, (uint16_t*)&data, 1, 1000);
}
void I2SClass::write(uint16_t *data, uint16_t size) {
HAL_I2S_Transmit(&handle, data, size, 1000);
}
void I2SClass::write32(uint32_t *data, uint16_t size) {
HAL_I2S_Transmit(&handle, (uint16_t*)data, size, 1000);
}

View File

@ -1 +1,36 @@
// TODO implement https://www.arduino.cc/en/Reference/I2S using HAL_I2S_xxx
#ifndef _I2S_H
#define _I2S_H
#include "stm32_def.h"
typedef enum {
I2S_PHILIPS_MODE,
I2S_RIGHT_JUSTIFIED_MODE,
I2S_LEFT_JUSTIFIED_MODE
} i2s_mode_t;
class I2SClass {
public:
I2SClass(SPI_TypeDef *instance);
I2SClass(SPI_TypeDef *instance, uint8_t sd, uint8_t ws, uint8_t ck);
uint8_t begin(i2s_mode_t mode, uint32_t sampleRate, uint8_t bitsPerSample);
void write(uint16_t data);
void write32(uint32_t data);
void write(uint16_t *data, uint16_t size);
void write32(uint32_t *data, uint16_t size);
I2S_HandleTypeDef handle;
GPIO_TypeDef *sdPort = NULL;
uint32_t sdPin = 0;
GPIO_TypeDef *wsPort = NULL;
uint32_t wsPin = 0;
GPIO_TypeDef *ckPort = NULL;
uint32_t ckPin = 0;
};
#endif

View File

@ -4,6 +4,7 @@
void SystemClock_Config(void) {
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
__HAL_RCC_PWR_CLK_ENABLE();
@ -33,6 +34,14 @@ void SystemClock_Config(void) {
Error_Handler();
}
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2S;
PeriphClkInitStruct.PLLI2S.PLLI2SN = 192;
PeriphClkInitStruct.PLLI2S.PLLI2SR = 2;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
Error_Handler();
}
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

View File

@ -4,6 +4,7 @@
void SystemClock_Config(void) {
RCC_OscInitTypeDef RCC_OscInitStruct;
RCC_ClkInitTypeDef RCC_ClkInitStruct;
RCC_PeriphCLKInitTypeDef PeriphClkInitStruct;
__HAL_RCC_PWR_CLK_ENABLE();
@ -33,6 +34,15 @@ void SystemClock_Config(void) {
Error_Handler();
}
PeriphClkInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2S;
PeriphClkInitStruct.PLLI2S.PLLI2SN = 192;
PeriphClkInitStruct.PLLI2S.PLLI2SR = 2;
if (HAL_RCCEx_PeriphCLKConfig(&PeriphClkInitStruct) != HAL_OK)
{
Error_Handler();
}
HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);

View File

@ -2,46 +2,49 @@
#include "stm32_gpio.h"
extern const int flash_size = 512 * 1024;
const stm32_port_pin_type variant_pin_list[] = {
{ GPIOA, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_1 },
{ GPIOA, GPIO_PIN_2 },
{ GPIOA, GPIO_PIN_3 },
{ GPIOA, GPIO_PIN_4 },
{ GPIOA, GPIO_PIN_5 },
{ GPIOA, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_7 },
{ GPIOA, GPIO_PIN_2 },
{ GPIOA, GPIO_PIN_10},
{ GPIOB, GPIO_PIN_3 },
{ GPIOB, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_10},
{ GPIOA, GPIO_PIN_8 },
{ GPIOA, GPIO_PIN_9 },
{ GPIOA, GPIO_PIN_10},
{ GPIOC, GPIO_PIN_7 },
{ GPIOB, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_7 },
{ GPIOA, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_9 },
{ GPIOB, GPIO_PIN_8 },
{ GPIOA, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_1 },
{ GPIOA, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_0 },
{ GPIOC, GPIO_PIN_1 },
{ GPIOC, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_11},
{ GPIOA, GPIO_PIN_12},
{ GPIOA, GPIO_PIN_13},
{ GPIOA, GPIO_PIN_14},
{ GPIOA, GPIO_PIN_15},
{ GPIOB, GPIO_PIN_0 },
{ GPIOB, GPIO_PIN_1 },
{ GPIOB, GPIO_PIN_2 },
{ GPIOB, GPIO_PIN_3 },
{ GPIOB, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_6 },
{ GPIOB, GPIO_PIN_7 },
{ GPIOB, GPIO_PIN_8 },
{ GPIOB, GPIO_PIN_9 },
{ GPIOB, GPIO_PIN_10},
{ GPIOB, GPIO_PIN_12},
{ GPIOB, GPIO_PIN_13},
{ GPIOB, GPIO_PIN_14},
{ GPIOB, GPIO_PIN_15},
{ GPIOC, GPIO_PIN_0 },
{ GPIOC, GPIO_PIN_1 },
{ GPIOC, GPIO_PIN_2 },
{ GPIOC, GPIO_PIN_3 },
{ GPIOC, GPIO_PIN_4 },
{ GPIOC, GPIO_PIN_5 },
{ GPIOC, GPIO_PIN_6 },
{ GPIOC, GPIO_PIN_7 },
{ GPIOC, GPIO_PIN_8 },
{ GPIOC, GPIO_PIN_9 },
{ GPIOC, GPIO_PIN_10},

View File

@ -11,46 +11,54 @@
#define SDA PB9
#define SCL PB8
#define A0 PA0
#define A1 PA1
#define A2 PA4
#define A3 PB0
#define A4 PC1
#define A5 PC0
enum {
PA0 ,
PA1 ,
PA2 ,
PA3 ,
PA4 ,
PA5 ,
PA6 ,
PA7 ,
PA8 ,
PA9 ,
PA10,
PA3 , // D0
PA2 , // D1
PA10, // D2
PB3 , // D3
PB5 , // D4
PB4 , // D5
PB10, // D6
PA8 , // D7
PA9 , // D8
PC7 , // D9
PB6 , // D10
PA7 , // D11
PA6 , // D12
PA5 , // D13
PB9 , // D14
PB8 , // D15
PA0 , // D16 / A0
PA1 , // D17 / A1
PA4 , // D18 / A2
PB0 , // D19 / A3
PC1 , // D20 / A4
PC0 , // D21 / A5
PA11,
PA12,
PA13,
PA14,
PA15,
PB0 ,
PB1 ,
PB2 ,
PB3 ,
PB4 ,
PB5 ,
PB6 ,
PB7 ,
PB8 ,
PB9 ,
PB10,
PB12,
PB13,
PB14,
PB15,
PC0 ,
PC1 ,
PC2 ,
PC3 ,
PC4 ,
PC5 ,
PC6 ,
PC7 ,
PC8 ,
PC9 ,
PC10,

View File

@ -2,46 +2,49 @@
#include "stm32_gpio.h"
extern const int flash_size = 512 * 1024;
const stm32_port_pin_type variant_pin_list[] = {
{ GPIOA, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_1 },
{ GPIOA, GPIO_PIN_2 },
{ GPIOA, GPIO_PIN_3 },
{ GPIOA, GPIO_PIN_4 },
{ GPIOA, GPIO_PIN_5 },
{ GPIOA, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_7 },
{ GPIOA, GPIO_PIN_2 },
{ GPIOA, GPIO_PIN_10},
{ GPIOB, GPIO_PIN_3 },
{ GPIOB, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_10},
{ GPIOA, GPIO_PIN_8 },
{ GPIOA, GPIO_PIN_9 },
{ GPIOA, GPIO_PIN_10},
{ GPIOC, GPIO_PIN_7 },
{ GPIOB, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_7 },
{ GPIOA, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_9 },
{ GPIOB, GPIO_PIN_8 },
{ GPIOA, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_1 },
{ GPIOA, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_0 },
{ GPIOC, GPIO_PIN_1 },
{ GPIOC, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_11},
{ GPIOA, GPIO_PIN_12},
{ GPIOA, GPIO_PIN_13},
{ GPIOA, GPIO_PIN_14},
{ GPIOA, GPIO_PIN_15},
{ GPIOB, GPIO_PIN_0 },
{ GPIOB, GPIO_PIN_1 },
{ GPIOB, GPIO_PIN_2 },
{ GPIOB, GPIO_PIN_3 },
{ GPIOB, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_6 },
{ GPIOB, GPIO_PIN_7 },
{ GPIOB, GPIO_PIN_8 },
{ GPIOB, GPIO_PIN_9 },
{ GPIOB, GPIO_PIN_10},
{ GPIOB, GPIO_PIN_12},
{ GPIOB, GPIO_PIN_13},
{ GPIOB, GPIO_PIN_14},
{ GPIOB, GPIO_PIN_15},
{ GPIOC, GPIO_PIN_0 },
{ GPIOC, GPIO_PIN_1 },
{ GPIOC, GPIO_PIN_2 },
{ GPIOC, GPIO_PIN_3 },
{ GPIOC, GPIO_PIN_4 },
{ GPIOC, GPIO_PIN_5 },
{ GPIOC, GPIO_PIN_6 },
{ GPIOC, GPIO_PIN_7 },
{ GPIOC, GPIO_PIN_8 },
{ GPIOC, GPIO_PIN_9 },
{ GPIOC, GPIO_PIN_10},

View File

@ -11,46 +11,54 @@
#define SDA PB9
#define SCL PB8
#define A0 PA0
#define A1 PA1
#define A2 PA4
#define A3 PB0
#define A4 PC1
#define A5 PC0
enum {
PA0 ,
PA1 ,
PA2 ,
PA3 ,
PA4 ,
PA5 ,
PA6 ,
PA7 ,
PA8 ,
PA9 ,
PA10,
PA3 , // D0
PA2 , // D1
PA10, // D2
PB3 , // D3
PB5 , // D4
PB4 , // D5
PB10, // D6
PA8 , // D7
PA9 , // D8
PC7 , // D9
PB6 , // D10
PA7 , // D11
PA6 , // D12
PA5 , // D13
PB9 , // D14
PB8 , // D15
PA0 , // D16 / A0
PA1 , // D17 / A1
PA4 , // D18 / A2
PB0 , // D19 / A3
PC1 , // D20 / A4
PC0 , // D21 / A5
PA11,
PA12,
PA13,
PA14,
PA15,
PB0 ,
PB1 ,
PB2 ,
PB3 ,
PB4 ,
PB5 ,
PB6 ,
PB7 ,
PB8 ,
PB9 ,
PB10,
PB12,
PB13,
PB14,
PB15,
PC0 ,
PC1 ,
PC2 ,
PC3 ,
PC4 ,
PC5 ,
PC6 ,
PC7 ,
PC8 ,
PC9 ,
PC10,

View File

@ -2,46 +2,49 @@
#include "stm32_gpio.h"
extern const int flash_size = 512 * 1024;
const stm32_port_pin_type variant_pin_list[] = {
{ GPIOA, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_1 },
{ GPIOA, GPIO_PIN_2 },
{ GPIOA, GPIO_PIN_3 },
{ GPIOA, GPIO_PIN_4 },
{ GPIOA, GPIO_PIN_5 },
{ GPIOA, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_7 },
{ GPIOA, GPIO_PIN_2 },
{ GPIOA, GPIO_PIN_10},
{ GPIOB, GPIO_PIN_3 },
{ GPIOB, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_10},
{ GPIOA, GPIO_PIN_8 },
{ GPIOA, GPIO_PIN_9 },
{ GPIOA, GPIO_PIN_10},
{ GPIOC, GPIO_PIN_7 },
{ GPIOB, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_7 },
{ GPIOA, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_9 },
{ GPIOB, GPIO_PIN_8 },
{ GPIOA, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_1 },
{ GPIOA, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_0 },
{ GPIOC, GPIO_PIN_1 },
{ GPIOC, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_11},
{ GPIOA, GPIO_PIN_12},
{ GPIOA, GPIO_PIN_13},
{ GPIOA, GPIO_PIN_14},
{ GPIOA, GPIO_PIN_15},
{ GPIOB, GPIO_PIN_0 },
{ GPIOB, GPIO_PIN_1 },
{ GPIOB, GPIO_PIN_2 },
{ GPIOB, GPIO_PIN_3 },
{ GPIOB, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_6 },
{ GPIOB, GPIO_PIN_7 },
{ GPIOB, GPIO_PIN_8 },
{ GPIOB, GPIO_PIN_9 },
{ GPIOB, GPIO_PIN_10},
{ GPIOB, GPIO_PIN_12},
{ GPIOB, GPIO_PIN_13},
{ GPIOB, GPIO_PIN_14},
{ GPIOB, GPIO_PIN_15},
{ GPIOC, GPIO_PIN_0 },
{ GPIOC, GPIO_PIN_1 },
{ GPIOC, GPIO_PIN_2 },
{ GPIOC, GPIO_PIN_3 },
{ GPIOC, GPIO_PIN_4 },
{ GPIOC, GPIO_PIN_5 },
{ GPIOC, GPIO_PIN_6 },
{ GPIOC, GPIO_PIN_7 },
{ GPIOC, GPIO_PIN_8 },
{ GPIOC, GPIO_PIN_9 },
{ GPIOC, GPIO_PIN_10},

View File

@ -11,46 +11,54 @@
#define SDA PB9
#define SCL PB8
#define A0 PA0
#define A1 PA1
#define A2 PA4
#define A3 PB0
#define A4 PC1
#define A5 PC0
enum {
PA0 ,
PA1 ,
PA2 ,
PA3 ,
PA4 ,
PA5 ,
PA6 ,
PA7 ,
PA8 ,
PA9 ,
PA10,
PA3 , // D0
PA2 , // D1
PA10, // D2
PB3 , // D3
PB5 , // D4
PB4 , // D5
PB10, // D6
PA8 , // D7
PA9 , // D8
PC7 , // D9
PB6 , // D10
PA7 , // D11
PA6 , // D12
PA5 , // D13
PB9 , // D14
PB8 , // D15
PA0 , // D16 / A0
PA1 , // D17 / A1
PA4 , // D18 / A2
PB0 , // D19 / A3
PC1 , // D20 / A4
PC0 , // D21 / A5
PA11,
PA12,
PA13,
PA14,
PA15,
PB0 ,
PB1 ,
PB2 ,
PB3 ,
PB4 ,
PB5 ,
PB6 ,
PB7 ,
PB8 ,
PB9 ,
PB10,
PB12,
PB13,
PB14,
PB15,
PC0 ,
PC1 ,
PC2 ,
PC3 ,
PC4 ,
PC5 ,
PC6 ,
PC7 ,
PC8 ,
PC9 ,
PC10,

View File

@ -5,45 +5,46 @@
extern const int flash_size = 512 * 1024;
const stm32_port_pin_type variant_pin_list[] = {
{ GPIOA, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_1 },
{ GPIOA, GPIO_PIN_2 },
{ GPIOA, GPIO_PIN_3 },
{ GPIOA, GPIO_PIN_4 },
{ GPIOA, GPIO_PIN_5 },
{ GPIOA, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_7 },
{ GPIOA, GPIO_PIN_2 },
{ GPIOA, GPIO_PIN_10},
{ GPIOB, GPIO_PIN_3 },
{ GPIOB, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_10},
{ GPIOA, GPIO_PIN_8 },
{ GPIOA, GPIO_PIN_9 },
{ GPIOA, GPIO_PIN_10},
{ GPIOC, GPIO_PIN_7 },
{ GPIOB, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_7 },
{ GPIOA, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_9 },
{ GPIOB, GPIO_PIN_8 },
{ GPIOA, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_1 },
{ GPIOA, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_0 },
{ GPIOC, GPIO_PIN_1 },
{ GPIOC, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_11},
{ GPIOA, GPIO_PIN_12},
{ GPIOA, GPIO_PIN_13},
{ GPIOA, GPIO_PIN_14},
{ GPIOA, GPIO_PIN_15},
{ GPIOB, GPIO_PIN_0 },
{ GPIOB, GPIO_PIN_1 },
{ GPIOB, GPIO_PIN_2 },
{ GPIOB, GPIO_PIN_3 },
{ GPIOB, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_6 },
{ GPIOB, GPIO_PIN_7 },
{ GPIOB, GPIO_PIN_8 },
{ GPIOB, GPIO_PIN_9 },
{ GPIOB, GPIO_PIN_10},
{ GPIOB, GPIO_PIN_12},
{ GPIOB, GPIO_PIN_13},
{ GPIOB, GPIO_PIN_14},
{ GPIOB, GPIO_PIN_15},
{ GPIOC, GPIO_PIN_0 },
{ GPIOC, GPIO_PIN_1 },
{ GPIOC, GPIO_PIN_2 },
{ GPIOC, GPIO_PIN_3 },
{ GPIOC, GPIO_PIN_4 },
{ GPIOC, GPIO_PIN_5 },
{ GPIOC, GPIO_PIN_6 },
{ GPIOC, GPIO_PIN_7 },
{ GPIOC, GPIO_PIN_8 },
{ GPIOC, GPIO_PIN_9 },
{ GPIOC, GPIO_PIN_10},

View File

@ -11,46 +11,54 @@
#define SDA PB9
#define SCL PB8
#define A0 PA0
#define A1 PA1
#define A2 PA4
#define A3 PB0
#define A4 PC1
#define A5 PC0
enum {
PA0 ,
PA1 ,
PA2 ,
PA3 ,
PA4 ,
PA5 ,
PA6 ,
PA7 ,
PA8 ,
PA9 ,
PA10,
PA3 , // D0
PA2 , // D1
PA10, // D2
PB3 , // D3
PB5 , // D4
PB4 , // D5
PB10, // D6
PA8 , // D7
PA9 , // D8
PC7 , // D9
PB6 , // D10
PA7 , // D11
PA6 , // D12
PA5 , // D13
PB9 , // D14
PB8 , // D15
PA0 , // D16 / A0
PA1 , // D17 / A1
PA4 , // D18 / A2
PB0 , // D19 / A3
PC1 , // D20 / A4
PC0 , // D21 / A5
PA11,
PA12,
PA13,
PA14,
PA15,
PB0 ,
PB1 ,
PB2 ,
PB3 ,
PB4 ,
PB5 ,
PB6 ,
PB7 ,
PB8 ,
PB9 ,
PB10,
PB12,
PB13,
PB14,
PB15,
PC0 ,
PC1 ,
PC2 ,
PC3 ,
PC4 ,
PC5 ,
PC6 ,
PC7 ,
PC8 ,
PC9 ,
PC10,

View File

@ -2,46 +2,49 @@
#include "stm32_gpio.h"
extern const int flash_size = 512 * 1024;
const stm32_port_pin_type variant_pin_list[] = {
{ GPIOA, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_1 },
{ GPIOA, GPIO_PIN_2 },
{ GPIOA, GPIO_PIN_3 },
{ GPIOA, GPIO_PIN_4 },
{ GPIOA, GPIO_PIN_5 },
{ GPIOA, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_7 },
{ GPIOA, GPIO_PIN_2 },
{ GPIOA, GPIO_PIN_10},
{ GPIOB, GPIO_PIN_3 },
{ GPIOB, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_10},
{ GPIOA, GPIO_PIN_8 },
{ GPIOA, GPIO_PIN_9 },
{ GPIOA, GPIO_PIN_10},
{ GPIOC, GPIO_PIN_7 },
{ GPIOB, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_7 },
{ GPIOA, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_9 },
{ GPIOB, GPIO_PIN_8 },
{ GPIOA, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_1 },
{ GPIOA, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_0 },
{ GPIOC, GPIO_PIN_1 },
{ GPIOC, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_11},
{ GPIOA, GPIO_PIN_12},
{ GPIOA, GPIO_PIN_13},
{ GPIOA, GPIO_PIN_14},
{ GPIOA, GPIO_PIN_15},
{ GPIOB, GPIO_PIN_0 },
{ GPIOB, GPIO_PIN_1 },
{ GPIOB, GPIO_PIN_2 },
{ GPIOB, GPIO_PIN_3 },
{ GPIOB, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_6 },
{ GPIOB, GPIO_PIN_7 },
{ GPIOB, GPIO_PIN_8 },
{ GPIOB, GPIO_PIN_9 },
{ GPIOB, GPIO_PIN_10},
{ GPIOB, GPIO_PIN_12},
{ GPIOB, GPIO_PIN_13},
{ GPIOB, GPIO_PIN_14},
{ GPIOB, GPIO_PIN_15},
{ GPIOC, GPIO_PIN_0 },
{ GPIOC, GPIO_PIN_1 },
{ GPIOC, GPIO_PIN_2 },
{ GPIOC, GPIO_PIN_3 },
{ GPIOC, GPIO_PIN_4 },
{ GPIOC, GPIO_PIN_5 },
{ GPIOC, GPIO_PIN_6 },
{ GPIOC, GPIO_PIN_7 },
{ GPIOC, GPIO_PIN_8 },
{ GPIOC, GPIO_PIN_9 },
{ GPIOC, GPIO_PIN_10},

View File

@ -11,46 +11,54 @@
#define SDA PB9
#define SCL PB8
#define A0 PA0
#define A1 PA1
#define A2 PA4
#define A3 PB0
#define A4 PC1
#define A5 PC0
enum {
PA0 ,
PA1 ,
PA2 ,
PA3 ,
PA4 ,
PA5 ,
PA6 ,
PA7 ,
PA8 ,
PA9 ,
PA10,
PA3 , // D0
PA2 , // D1
PA10, // D2
PB3 , // D3
PB5 , // D4
PB4 , // D5
PB10, // D6
PA8 , // D7
PA9 , // D8
PC7 , // D9
PB6 , // D10
PA7 , // D11
PA6 , // D12
PA5 , // D13
PB9 , // D14
PB8 , // D15
PA0 , // D16 / A0
PA1 , // D17 / A1
PA4 , // D18 / A2
PB0 , // D19 / A3
PC1 , // D20 / A4
PC0 , // D21 / A5
PA11,
PA12,
PA13,
PA14,
PA15,
PB0 ,
PB1 ,
PB2 ,
PB3 ,
PB4 ,
PB5 ,
PB6 ,
PB7 ,
PB8 ,
PB9 ,
PB10,
PB12,
PB13,
PB14,
PB15,
PC0 ,
PC1 ,
PC2 ,
PC3 ,
PC4 ,
PC5 ,
PC6 ,
PC7 ,
PC8 ,
PC9 ,
PC10,

View File

@ -2,46 +2,49 @@
#include "stm32_gpio.h"
extern const int flash_size = 512 * 1024;
const stm32_port_pin_type variant_pin_list[] = {
{ GPIOA, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_1 },
{ GPIOA, GPIO_PIN_2 },
{ GPIOA, GPIO_PIN_3 },
{ GPIOA, GPIO_PIN_4 },
{ GPIOA, GPIO_PIN_5 },
{ GPIOA, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_7 },
{ GPIOA, GPIO_PIN_2 },
{ GPIOA, GPIO_PIN_10},
{ GPIOB, GPIO_PIN_3 },
{ GPIOB, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_10},
{ GPIOA, GPIO_PIN_8 },
{ GPIOA, GPIO_PIN_9 },
{ GPIOA, GPIO_PIN_10},
{ GPIOC, GPIO_PIN_7 },
{ GPIOB, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_7 },
{ GPIOA, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_9 },
{ GPIOB, GPIO_PIN_8 },
{ GPIOA, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_1 },
{ GPIOA, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_0 },
{ GPIOC, GPIO_PIN_1 },
{ GPIOC, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_11},
{ GPIOA, GPIO_PIN_12},
{ GPIOA, GPIO_PIN_13},
{ GPIOA, GPIO_PIN_14},
{ GPIOA, GPIO_PIN_15},
{ GPIOB, GPIO_PIN_0 },
{ GPIOB, GPIO_PIN_1 },
{ GPIOB, GPIO_PIN_2 },
{ GPIOB, GPIO_PIN_3 },
{ GPIOB, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_6 },
{ GPIOB, GPIO_PIN_7 },
{ GPIOB, GPIO_PIN_8 },
{ GPIOB, GPIO_PIN_9 },
{ GPIOB, GPIO_PIN_10},
{ GPIOB, GPIO_PIN_12},
{ GPIOB, GPIO_PIN_13},
{ GPIOB, GPIO_PIN_14},
{ GPIOB, GPIO_PIN_15},
{ GPIOC, GPIO_PIN_0 },
{ GPIOC, GPIO_PIN_1 },
{ GPIOC, GPIO_PIN_2 },
{ GPIOC, GPIO_PIN_3 },
{ GPIOC, GPIO_PIN_4 },
{ GPIOC, GPIO_PIN_5 },
{ GPIOC, GPIO_PIN_6 },
{ GPIOC, GPIO_PIN_7 },
{ GPIOC, GPIO_PIN_8 },
{ GPIOC, GPIO_PIN_9 },
{ GPIOC, GPIO_PIN_10},

View File

@ -11,46 +11,54 @@
#define SDA PB9
#define SCL PB8
#define A0 PA0
#define A1 PA1
#define A2 PA4
#define A3 PB0
#define A4 PC1
#define A5 PC0
enum {
PA0 ,
PA1 ,
PA2 ,
PA3 ,
PA4 ,
PA5 ,
PA6 ,
PA7 ,
PA8 ,
PA9 ,
PA10,
PA3 , // D0
PA2 , // D1
PA10, // D2
PB3 , // D3
PB5 , // D4
PB4 , // D5
PB10, // D6
PA8 , // D7
PA9 , // D8
PC7 , // D9
PB6 , // D10
PA7 , // D11
PA6 , // D12
PA5 , // D13
PB9 , // D14
PB8 , // D15
PA0 , // D16 / A0
PA1 , // D17 / A1
PA4 , // D18 / A2
PB0 , // D19 / A3
PC1 , // D20 / A4
PC0 , // D21 / A5
PA11,
PA12,
PA13,
PA14,
PA15,
PB0 ,
PB1 ,
PB2 ,
PB3 ,
PB4 ,
PB5 ,
PB6 ,
PB7 ,
PB8 ,
PB9 ,
PB10,
PB12,
PB13,
PB14,
PB15,
PC0 ,
PC1 ,
PC2 ,
PC3 ,
PC4 ,
PC5 ,
PC6 ,
PC7 ,
PC8 ,
PC9 ,
PC10,

View File

@ -2,46 +2,49 @@
#include "stm32_gpio.h"
extern const int flash_size = 512 * 1024;
const stm32_port_pin_type variant_pin_list[] = {
{ GPIOA, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_1 },
{ GPIOA, GPIO_PIN_2 },
{ GPIOA, GPIO_PIN_3 },
{ GPIOA, GPIO_PIN_4 },
{ GPIOA, GPIO_PIN_5 },
{ GPIOA, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_7 },
{ GPIOA, GPIO_PIN_2 },
{ GPIOA, GPIO_PIN_10},
{ GPIOB, GPIO_PIN_3 },
{ GPIOB, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_10},
{ GPIOA, GPIO_PIN_8 },
{ GPIOA, GPIO_PIN_9 },
{ GPIOA, GPIO_PIN_10},
{ GPIOC, GPIO_PIN_7 },
{ GPIOB, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_7 },
{ GPIOA, GPIO_PIN_6 },
{ GPIOA, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_9 },
{ GPIOB, GPIO_PIN_8 },
{ GPIOA, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_1 },
{ GPIOA, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_0 },
{ GPIOC, GPIO_PIN_1 },
{ GPIOC, GPIO_PIN_0 },
{ GPIOA, GPIO_PIN_11},
{ GPIOA, GPIO_PIN_12},
{ GPIOA, GPIO_PIN_13},
{ GPIOA, GPIO_PIN_14},
{ GPIOA, GPIO_PIN_15},
{ GPIOB, GPIO_PIN_0 },
{ GPIOB, GPIO_PIN_1 },
{ GPIOB, GPIO_PIN_2 },
{ GPIOB, GPIO_PIN_3 },
{ GPIOB, GPIO_PIN_4 },
{ GPIOB, GPIO_PIN_5 },
{ GPIOB, GPIO_PIN_6 },
{ GPIOB, GPIO_PIN_7 },
{ GPIOB, GPIO_PIN_8 },
{ GPIOB, GPIO_PIN_9 },
{ GPIOB, GPIO_PIN_10},
{ GPIOB, GPIO_PIN_12},
{ GPIOB, GPIO_PIN_13},
{ GPIOB, GPIO_PIN_14},
{ GPIOB, GPIO_PIN_15},
{ GPIOC, GPIO_PIN_0 },
{ GPIOC, GPIO_PIN_1 },
{ GPIOC, GPIO_PIN_2 },
{ GPIOC, GPIO_PIN_3 },
{ GPIOC, GPIO_PIN_4 },
{ GPIOC, GPIO_PIN_5 },
{ GPIOC, GPIO_PIN_6 },
{ GPIOC, GPIO_PIN_7 },
{ GPIOC, GPIO_PIN_8 },
{ GPIOC, GPIO_PIN_9 },
{ GPIOC, GPIO_PIN_10},

View File

@ -11,46 +11,54 @@
#define SDA PB9
#define SCL PB8
#define A0 PA0
#define A1 PA1
#define A2 PA4
#define A3 PB0
#define A4 PC1
#define A5 PC0
enum {
PA0 ,
PA1 ,
PA2 ,
PA3 ,
PA4 ,
PA5 ,
PA6 ,
PA7 ,
PA8 ,
PA9 ,
PA10,
PA3 , // D0
PA2 , // D1
PA10, // D2
PB3 , // D3
PB5 , // D4
PB4 , // D5
PB10, // D6
PA8 , // D7
PA9 , // D8
PC7 , // D9
PB6 , // D10
PA7 , // D11
PA6 , // D12
PA5 , // D13
PB9 , // D14
PB8 , // D15
PA0 , // D16 / A0
PA1 , // D17 / A1
PA4 , // D18 / A2
PB0 , // D19 / A3
PC1 , // D20 / A4
PC0 , // D21 / A5
PA11,
PA12,
PA13,
PA14,
PA15,
PB0 ,
PB1 ,
PB2 ,
PB3 ,
PB4 ,
PB5 ,
PB6 ,
PB7 ,
PB8 ,
PB9 ,
PB10,
PB12,
PB13,
PB14,
PB15,
PC0 ,
PC1 ,
PC2 ,
PC3 ,
PC4 ,
PC5 ,
PC6 ,
PC7 ,
PC8 ,
PC9 ,
PC10,

View File

@ -197,8 +197,6 @@
<li><a href="#8-run-the-blink-example-on-your-new-board">8. Run the blink example on your new board</a></li>
<li><a href="#9-run-the-tests-on-the-board-to-check-if-it-is-working">9. Run the tests on the board to check if it is working</a></li>
</ul>
@ -206,17 +204,51 @@
<div class="col-md-9" role="main">
<h1 id="add-your-board">Add your board:</h1>
<p>TODO explain all steps</p>
<h2 id="1-create-a-copy-of-the-stm32variantstemplate-folder-with-a-name-of-your-choice">1. Create a copy of the STM32/variants/TEMPLATE folder with a name of your choice.</h2>
<p>TODO make TEMPLATE folder</p>
<p>TODO create TEMPLATE, for now just use an existing one</p>
<h2 id="2-edit-the-ldscriptld-file">2. Edit the ldscript.ld file</h2>
<ol>
<li>Change the _estack to point to the end of RAM</li>
<li>FLASH LENGTH to be the size of RAM of the microcontroller</li>
<li>RAM LENGTH to be the size of RAM of the microcontroller</li>
</ol>
<p>TODO CCRAM? SDRAM?</p>
<h2 id="3-edit-the-varianth-file">3. Edit the variant.h file</h2>
<ol>
<li>Copy the <code>enum {</code>... from <code>system/STM32XX/stm32_chip/stm32_STM32XXXXXX.h</code> file. </li>
<li>If the board has pin name - pin number assigments (for example arduino headers), rearrange the enum accordingly.</li>
<li>Change LED_BUILTIN, MOSI, MISO... macros to point to the primary LED, primary SPI, primary I2C pins.</li>
<li>Add board specific macros if the board has extra leds, buttons, SPI CS select lines etc...</li>
</ol>
<h2 id="4-edit-the-variantcpp-file">4. Edit the variant.cpp file</h2>
<ol>
<li>Copy the <code>const stm32_port_pin_type variant_pin_list[] = {</code> from <code>system/STM32XX/stm32_chip/stm32_STM32XXXXXX.h</code> file.</li>
<li>Rearrange to be the same as <code>enum {</code> in <code>variant.h</code></li>
</ol>
<h2 id="5-edit-the-systemclock_configc-file">5. Edit the systemclock_config.c file</h2>
<ol>
<li>Run STM32CubeMX, select the chip for your board</li>
<li>If the board has external crystal, set RCC HSE to crystal. In clock configuration, set PLL Source to HSE, set HSE to the frequency of the board crystal.</li>
<li>Set some peripherals (SPI, I2C, SDIO, USB, ...), so that the clock configuration will generate extra code needed for those peripherals, and bounds check the frequencies.</li>
<li>Go to clock configuration, set everything to maximum :), let CubeMX figure out the rest.</li>
<li>Click generate. Set toolchain/IDE to SW4STM32. Clik OK</li>
<li>From the generated src/main.c, copy <code>void SystemClock_Config(void) {</code> into your <code>variant/.../systemclock_config.c</code></li>
</ol>
<h2 id="6-edit-the-boardstxt-file">6. Edit the boards.txt file</h2>
<p>TODO create template. For now, copy an existing board</p>
<ol>
<li>Rename the board</li>
<li>Change <code>build.mcu=</code> to your cortex-mX version</li>
<li>Change <code>build.series=</code> to STM32XX, where XX is the chip series</li>
<li>Change <code>build.extra_flags=-DSTM32XXXXXX</code> to be the exact chip version</li>
<li>Change <code>upload.maximum_size=</code> and <code>upload.maximum_data_size=</code> to the RAM/FLASH size of the chip</li>
<li>If the external crystal is not the board default in <code>system/STM32XX/HAL_SRC/system_stm32XXxx.c</code>, add <code>-DHSE_VALUE=8000000</code> to <code>xxx.build.extra_flags</code></li>
<li>TODO explain upload / usb / serial menu options</li>
</ol>
<h2 id="7-restart">7. Restart</h2>
<p>Restart Arduino IDE</p>
<h2 id="8-run-the-blink-example-on-your-new-board">8. Run the blink example on your new board</h2>
<h2 id="9-run-the-tests-on-the-board-to-check-if-it-is-working">9. Run the <a href="../test/">tests</a> on the board to check if it is working</h2></div>
<p>Run examples / basic / blink</p></div>
</div>
<footer class="col-md-12">

View File

@ -344,23 +344,23 @@ TODO not all implemented</p>
</tr>
<tr>
<td>MOSI</td>
<td>MOSI pin of the first <a href="arduino_libraries.md#spi">SPI</a></td>
<td>MOSI pin of the first <a href="../spi/">SPI</a></td>
</tr>
<tr>
<td>MISO</td>
<td>MISO pin of the first <a href="arduino_libraries.md#spi">SPI</a></td>
<td>MISO pin of the first <a href="../spi/">SPI</a></td>
</tr>
<tr>
<td>SCK</td>
<td>SCK pin of the first <a href="arduino_libraries.md#spi">SPI</a></td>
<td>SCK pin of the first <a href="../spi/">SPI</a></td>
</tr>
<tr>
<td>SDA</td>
<td>SDA pin of the first <a href="arduino_libraries.md#wire-i2c">I2C</a></td>
<td>SDA pin of the first <a href="../i2c/">I2C</a></td>
</tr>
<tr>
<td>SCL</td>
<td>SCL pin of the first <a href="arduino_libraries.md#wire-i2c">I2C</a></td>
<td>SCL pin of the first <a href="../i2c/">I2C</a></td>
</tr>
</tbody>
</table></div>

View File

@ -362,59 +362,54 @@
},
{
"location": "/add_board/",
"text": "Add your board:\n\n\nTODO explain all steps\n\n\n1. Create a copy of the STM32/variants/TEMPLATE folder with a name of your choice.\n\n\nTODO make TEMPLATE folder\n\n\n2. Edit the ldscript.ld file\n\n\n3. Edit the variant.h file\n\n\n4. Edit the variant.cpp file\n\n\n5. Edit the systemclock_config.c file\n\n\n6. Edit the boards.txt file\n\n\n7. Restart\n\n\n8. Run the blink example on your new board\n\n\n9. Run the \ntests\n on the board to check if it is working",
"text": "Add your board:\n\n\n1. Create a copy of the STM32/variants/TEMPLATE folder with a name of your choice.\n\n\nTODO create TEMPLATE, for now just use an existing one\n\n\n2. Edit the ldscript.ld file\n\n\n\n\nChange the _estack to point to the end of RAM\n\n\nFLASH LENGTH to be the size of RAM of the microcontroller\n\n\nRAM LENGTH to be the size of RAM of the microcontroller\n\n\n\n\nTODO CCRAM? SDRAM?\n\n\n3. Edit the variant.h file\n\n\n\n\nCopy the \nenum {\n... from \nsystem/STM32XX/stm32_chip/stm32_STM32XXXXXX.h\n file. \n\n\nIf the board has pin name - pin number assigments (for example arduino headers), rearrange the enum accordingly.\n\n\nChange LED_BUILTIN, MOSI, MISO... macros to point to the primary LED, primary SPI, primary I2C pins.\n\n\nAdd board specific macros if the board has extra leds, buttons, SPI CS select lines etc...\n\n\n\n\n4. Edit the variant.cpp file\n\n\n\n\nCopy the \nconst stm32_port_pin_type variant_pin_list[] = {\n from \nsystem/STM32XX/stm32_chip/stm32_STM32XXXXXX.h\n file.\n\n\nRearrange to be the same as \nenum {\n in \nvariant.h\n\n\n\n\n5. Edit the systemclock_config.c file\n\n\n\n\nRun STM32CubeMX, select the chip for your board\n\n\nIf the board has external crystal, set RCC HSE to crystal. In clock configuration, set PLL Source to HSE, set HSE to the frequency of the board crystal.\n\n\nSet some peripherals (SPI, I2C, SDIO, USB, ...), so that the clock configuration will generate extra code needed for those peripherals, and bounds check the frequencies.\n\n\nGo to clock configuration, set everything to maximum :), let CubeMX figure out the rest.\n\n\nClick generate. Set toolchain/IDE to SW4STM32. Clik OK\n\n\nFrom the generated src/main.c, copy \nvoid SystemClock_Config(void) {\n into your \nvariant/.../systemclock_config.c\n\n\n\n\n6. Edit the boards.txt file\n\n\nTODO create template. For now, copy an existing board\n\n\n\n\nRename the board\n\n\nChange \nbuild.mcu=\n to your cortex-mX version\n\n\nChange \nbuild.series=\n to STM32XX, where XX is the chip series\n\n\nChange \nbuild.extra_flags=-DSTM32XXXXXX\n to be the exact chip version\n\n\nChange \nupload.maximum_size=\n and \nupload.maximum_data_size=\n to the RAM/FLASH size of the chip\n\n\nIf the external crystal is not the board default in \nsystem/STM32XX/HAL_SRC/system_stm32XXxx.c\n, add \n-DHSE_VALUE=8000000\n to \nxxx.build.extra_flags\n\n\nTODO explain upload / usb / serial menu options\n\n\n\n\n7. Restart\n\n\nRestart Arduino IDE\n\n\n8. Run the blink example on your new board\n\n\nRun examples / basic / blink",
"title": "Adding a board"
},
{
"location": "/add_board/#add-your-board",
"text": "TODO explain all steps",
"text": "",
"title": "Add your board:"
},
{
"location": "/add_board/#1-create-a-copy-of-the-stm32variantstemplate-folder-with-a-name-of-your-choice",
"text": "TODO make TEMPLATE folder",
"text": "TODO create TEMPLATE, for now just use an existing one",
"title": "1. Create a copy of the STM32/variants/TEMPLATE folder with a name of your choice."
},
{
"location": "/add_board/#2-edit-the-ldscriptld-file",
"text": "",
"text": "Change the _estack to point to the end of RAM FLASH LENGTH to be the size of RAM of the microcontroller RAM LENGTH to be the size of RAM of the microcontroller TODO CCRAM? SDRAM?",
"title": "2. Edit the ldscript.ld file"
},
{
"location": "/add_board/#3-edit-the-varianth-file",
"text": "",
"text": "Copy the enum { ... from system/STM32XX/stm32_chip/stm32_STM32XXXXXX.h file. If the board has pin name - pin number assigments (for example arduino headers), rearrange the enum accordingly. Change LED_BUILTIN, MOSI, MISO... macros to point to the primary LED, primary SPI, primary I2C pins. Add board specific macros if the board has extra leds, buttons, SPI CS select lines etc...",
"title": "3. Edit the variant.h file"
},
{
"location": "/add_board/#4-edit-the-variantcpp-file",
"text": "",
"text": "Copy the const stm32_port_pin_type variant_pin_list[] = { from system/STM32XX/stm32_chip/stm32_STM32XXXXXX.h file. Rearrange to be the same as enum { in variant.h",
"title": "4. Edit the variant.cpp file"
},
{
"location": "/add_board/#5-edit-the-systemclock_configc-file",
"text": "",
"text": "Run STM32CubeMX, select the chip for your board If the board has external crystal, set RCC HSE to crystal. In clock configuration, set PLL Source to HSE, set HSE to the frequency of the board crystal. Set some peripherals (SPI, I2C, SDIO, USB, ...), so that the clock configuration will generate extra code needed for those peripherals, and bounds check the frequencies. Go to clock configuration, set everything to maximum :), let CubeMX figure out the rest. Click generate. Set toolchain/IDE to SW4STM32. Clik OK From the generated src/main.c, copy void SystemClock_Config(void) { into your variant/.../systemclock_config.c",
"title": "5. Edit the systemclock_config.c file"
},
{
"location": "/add_board/#6-edit-the-boardstxt-file",
"text": "",
"text": "TODO create template. For now, copy an existing board Rename the board Change build.mcu= to your cortex-mX version Change build.series= to STM32XX, where XX is the chip series Change build.extra_flags=-DSTM32XXXXXX to be the exact chip version Change upload.maximum_size= and upload.maximum_data_size= to the RAM/FLASH size of the chip If the external crystal is not the board default in system/STM32XX/HAL_SRC/system_stm32XXxx.c , add -DHSE_VALUE=8000000 to xxx.build.extra_flags TODO explain upload / usb / serial menu options",
"title": "6. Edit the boards.txt file"
},
{
"location": "/add_board/#7-restart",
"text": "",
"text": "Restart Arduino IDE",
"title": "7. Restart"
},
{
"location": "/add_board/#8-run-the-blink-example-on-your-new-board",
"text": "",
"text": "Run examples / basic / blink",
"title": "8. Run the blink example on your new board"
},
{
"location": "/add_board/#9-run-the-tests-on-the-board-to-check-if-it-is-working",
"text": "",
"title": "9. Run the tests on the board to check if it is working"
},
{
"location": "/test/",
"text": "Self tesing boards\n\n\nTo automatically check if the board works, there are tests in the library.\nThese work by connecting pins to \n\n\nGeneric STM32 Arduino API test\n\n\nThis test should work on almost all STM32 boards. \n\n\n\n\nFrom the arduino menu, select File/Examples/Examples for XXX/SelfTest\n\n\nConnect PA0 to PA1 to test digital/analog/read/write/interrupt\n\n\nConnect SPI MOSI to SPI MISO to test SPI\n\n\nSelect a free UART (not used for Serial) on the board, connect the RX to TX, set the SerialUartToTest macro in the sketch\n\n\nRun the sketch\n\n\n\n\nThe result should be short blink on the board LED.\nIf there was a failure, it is shown as a long LED \n\n\nThe results are also",

View File

@ -4,7 +4,7 @@
<url>
<loc>/</loc>
<lastmod>2017-04-21</lastmod>
<lastmod>2017-04-26</lastmod>
<changefreq>daily</changefreq>
</url>
@ -12,7 +12,7 @@
<url>
<loc>/upload/</loc>
<lastmod>2017-04-21</lastmod>
<lastmod>2017-04-26</lastmod>
<changefreq>daily</changefreq>
</url>
@ -21,43 +21,43 @@
<url>
<loc>/menu_options/</loc>
<lastmod>2017-04-21</lastmod>
<lastmod>2017-04-26</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/arduino_api/</loc>
<lastmod>2017-04-21</lastmod>
<lastmod>2017-04-26</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/spi/</loc>
<lastmod>2017-04-21</lastmod>
<lastmod>2017-04-26</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/i2c/</loc>
<lastmod>2017-04-21</lastmod>
<lastmod>2017-04-26</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/uart/</loc>
<lastmod>2017-04-21</lastmod>
<lastmod>2017-04-26</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/usb_cdc/</loc>
<lastmod>2017-04-21</lastmod>
<lastmod>2017-04-26</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/stm32_hal/</loc>
<lastmod>2017-04-21</lastmod>
<lastmod>2017-04-26</lastmod>
<changefreq>daily</changefreq>
</url>
@ -66,7 +66,7 @@
<url>
<loc>/libraries/</loc>
<lastmod>2017-04-21</lastmod>
<lastmod>2017-04-26</lastmod>
<changefreq>daily</changefreq>
</url>
@ -75,19 +75,19 @@
<url>
<loc>/boards/</loc>
<lastmod>2017-04-21</lastmod>
<lastmod>2017-04-26</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/add_board/</loc>
<lastmod>2017-04-21</lastmod>
<lastmod>2017-04-26</lastmod>
<changefreq>daily</changefreq>
</url>
<url>
<loc>/test/</loc>
<lastmod>2017-04-21</lastmod>
<lastmod>2017-04-26</lastmod>
<changefreq>daily</changefreq>
</url>
@ -96,7 +96,7 @@
<url>
<loc>/about/</loc>
<lastmod>2017-04-21</lastmod>
<lastmod>2017-04-26</lastmod>
<changefreq>daily</changefreq>
</url>

View File

@ -1,23 +1,54 @@
# Add your board:
TODO explain all steps
## 1. Create a copy of the STM32/variants/TEMPLATE folder with a name of your choice.
TODO make TEMPLATE folder
TODO create TEMPLATE, for now just use an existing one
## 2. Edit the ldscript.ld file
1. Change the _estack to point to the end of RAM
2. FLASH LENGTH to be the size of RAM of the microcontroller
3. RAM LENGTH to be the size of RAM of the microcontroller
TODO CCRAM? SDRAM?
## 3. Edit the variant.h file
1. Copy the `enum {`... from `system/STM32XX/stm32_chip/stm32_STM32XXXXXX.h` file.
2. If the board has pin name - pin number assigments (for example arduino headers), rearrange the enum accordingly.
3. Change LED_BUILTIN, MOSI, MISO... macros to point to the primary LED, primary SPI, primary I2C pins.
4. Add board specific macros if the board has extra leds, buttons, SPI CS select lines etc...
## 4. Edit the variant.cpp file
1. Copy the `const stm32_port_pin_type variant_pin_list[] = {` from `system/STM32XX/stm32_chip/stm32_STM32XXXXXX.h` file.
2. Rearrange to be the same as `enum {` in `variant.h`
## 5. Edit the systemclock_config.c file
1. Run STM32CubeMX, select the chip for your board
2. If the board has external crystal, set RCC HSE to crystal. In clock configuration, set PLL Source to HSE, set HSE to the frequency of the board crystal.
3. Set some peripherals (SPI, I2C, SDIO, USB, ...), so that the clock configuration will generate extra code needed for those peripherals, and bounds check the frequencies.
4. Go to clock configuration, set everything to maximum :), let CubeMX figure out the rest.
5. Click generate. Set toolchain/IDE to SW4STM32. Clik OK
6. From the generated src/main.c, copy `void SystemClock_Config(void) {` into your `variant/.../systemclock_config.c`
## 6. Edit the boards.txt file
TODO create template. For now, copy an existing board
1. Rename the board
2. Change `build.mcu=` to your cortex-mX version
3. Change `build.series=` to STM32XX, where XX is the chip series
4. Change `build.extra_flags=-DSTM32XXXXXX` to be the exact chip version
5. Change `upload.maximum_size=` and `upload.maximum_data_size=` to the RAM/FLASH size of the chip
6. If the external crystal is not the board default in `system/STM32XX/HAL_SRC/system_stm32XXxx.c`, add `-DHSE_VALUE=8000000` to `xxx.build.extra_flags`
7. TODO explain upload / usb / serial menu options
## 7. Restart
Restart Arduino IDE
## 8. Run the blink example on your new board
## 9. Run the [tests](test.md) on the board to check if it is working
Run examples / basic / blink

View File

@ -126,8 +126,8 @@ Constant | Meaning
------------------|-----------
LED_BUILTIN | The primary LED on board, if there is any
STM32_LED_BUILTIN_ACTIVE_LOW | If set, the onboard LED lights up when output is set to LOW
MOSI | MOSI pin of the first [SPI](arduino_libraries.md#spi)
MISO | MISO pin of the first [SPI](arduino_libraries.md#spi)
SCK | SCK pin of the first [SPI](arduino_libraries.md#spi)
SDA | SDA pin of the first [I2C](arduino_libraries.md#wire-i2c)
SCL | SCL pin of the first [I2C](arduino_libraries.md#wire-i2c)
MOSI | MOSI pin of the first [SPI](spi.md)
MISO | MISO pin of the first [SPI](spi.md)
SCK | SCK pin of the first [SPI](spi.md)
SDA | SDA pin of the first [I2C](i2c.md)
SCL | SCL pin of the first [I2C](i2c.md)

View File

@ -1,5 +1,9 @@
#!/bin/bash
$(dirname $0)/stlink/st-flash write "$4" 0x8000000
if [ `uname -m` == "x86_64" ]; then
$(dirname $0)/../linux64/stlink/st-flash write "$4" 0x8000000
else
$(dirname $0)/stlink/st-flash write "$4" 0x8000000
fi
exit 0
## Remove the lines 2 and 3 (above) if you want this script to wait until the Serial device has been enumerated and loaded before the script exits