STM32 Nucleo-L152RE

Support for the STM32 Nucleo-L152RE.

Hardware

MCU

MCU STM32L152RE
Family ARM Cortex-M3
Vendor ST Microelectronics
RAM 80Kb
Flash 512Kb
Frequency 32MHz (no external oscilator connected)
FPU no
Timers 8 (8x 16-bit, 1x 32-bit [TIM5])
ADCs 1x 42-channel 12-bit
UARTs 3
SPIs 2
I2Cs 2
Vcc 1.65V - 3.6V
Datasheet Datasheet
Reference Manual Reference Manual
Programming Manual Programming Manual
Board Manual Board Manual

User Interface

2 Button:

NAME USER RESET
Pin PC13 (IN) NRST
1 LEDs:

NAME LD2
Color green
Pin PA5

MCU

MCU STM32L152RE
Family ARM Cortex-M3
Vendor ST Microelectronics
RAM 80Kb
Flash 512Kb
Frequency 32MHz (no external oscilator connected)
FPU no
Timers 8 (8x 16-bit, 1x 32-bit [TIM5])
ADCs 1x 42-channel 12-bit
UARTs 3
SPIs 2
I2Cs 2
Vcc 1.65V - 3.6V
Datasheet Datasheet
Reference Manual Reference Manual
Programming Manual Programming Manual
Board Manual Board Manual

User Interface

2 Button:

NAME USER RESET
Pin PC13 (IN) NRST
1 LEDs:

NAME LD2
Color green
Pin PA5

Supported Toolchains

For using the st-nucleo-l1 board we strongly recommend the usage of the GNU Tools for ARM Embedded Processors toolchain.

OpenOCD

Please use an OpenOCD version checked out after Jan. 26th 2015. Building instructions can be found here.

Connecting an external UART adapter

  1. connect your usb tty to the st-link header as marked
  2. done

OpenOCD

Please use an OpenOCD version checked out after Jan. 26th 2015. Building instructions can be found here.

Connecting an external UART adapter

  1. connect your usb tty to the st-link header as marked
  2. done

Using UART

Using the UART isn’t too stable right now. For some using the USB interface just works, others have to connect the USB interface to a active USB hub and others again can only transmit over the USB interface and receive using an external UART adapter.

Connecting an external UART adapter

  1. connect your usb tty to the st-link header as marked
  2. done

CLOCK_HSI
1
(16000000U)             /* frequency of internal oscillator */
CLOCK_CORECLOCK
1
(32000000U)             /* targeted core clock frequency */
CLOCK_LSE
1
(0)
CLOCK_PLL_DIV
1
RCC_CFGR_PLLDIV2
CLOCK_PLL_MUL
1
RCC_CFGR_PLLMUL4
CLOCK_AHB_DIV
1
RCC_CFGR_HPRE_DIV1      /* AHB clock -> 32MHz */
CLOCK_APB2_DIV
1
RCC_CFGR_PPRE2_DIV1     /* APB2 clock -> 32MHz */
CLOCK_APB1_DIV
1
RCC_CFGR_PPRE1_DIV1     /* APB1 clock -> 32MHz */
CLOCK_FLASH_LATENCY
1
FLASH_ACR_LATENCY
CLOCK_AHB
1
(CLOCK_CORECLOCK / 1)
CLOCK_APB2
1
(CLOCK_CORECLOCK / 1)
CLOCK_APB1
1
(CLOCK_CORECLOCK / 1)
const timer_conf_t timer_config()
1
2
3
4
5
6
7
8
9
= {
    {
        .dev      = TIM5,
        .max      = 0xffffffff,
        .rcc_mask = RCC_APB1ENR_TIM5EN,
        .bus      = APB1,
        .irqn     = TIM5_IRQn
    }
}
TIMER_0_ISR
1
(isr_tim5)
TIMER_NUMOF
1
(sizeof(timer_config) / sizeof(timer_config[0]))
RTC_NUMOF
1
(1U)
const uart_conf_t uart_config()
UART_0_ISR
1
(isr_usart2)
UART_1_ISR
1
(isr_usart1)
UART_2_ISR
1
(isr_usart3)
UART_NUMOF
1
(sizeof(uart_config) / sizeof(uart_config[0]))
const pwm_conf_t pwm_config()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
= {
    {
        .dev      = TIM2,
        .rcc_mask = RCC_APB1ENR_TIM2EN,
        .chan     = { { .pin = GPIO_PIN(PORT_B, 3) ,  .cc_chan = 1 },
                      { .pin = GPIO_PIN(PORT_B, 10) , .cc_chan = 2 },
                      { .pin = GPIO_UNDEF,                    .cc_chan = 0 },
                      { .pin = GPIO_UNDEF,                    .cc_chan = 0 } },
        .af       = GPIO_AF1,
        .bus      = APB1
    },
    {
        .dev      = TIM3,
        .rcc_mask = RCC_APB1ENR_TIM3EN,
        .chan     = { { .pin = GPIO_PIN(PORT_B, 4) , .cc_chan = 0 },
                      { .pin = GPIO_PIN(PORT_C, 7) , .cc_chan = 1 },
                      { .pin = GPIO_PIN(PORT_C, 8),          .cc_chan = 2 },
                      { .pin = GPIO_PIN(PORT_C, 9),          .cc_chan = 3 } },
        .af       = GPIO_AF2,
        .bus      = APB1
    }
}
PWM_NUMOF
1
(sizeof(pwm_config) / sizeof(pwm_config[0]))
const uint8_t spi_divtable()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
= {
    {       
        7,  
        5,  
        4,  
        2,  
        1   
    },
    {       
        7,  
        5,  
        4,  
        2,  
        1   
    }
}
const spi_conf_t spi_config()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
= {
    {
        .dev      = SPI1,
        .mosi_pin = GPIO_PIN(PORT_A, 7),
        .miso_pin = GPIO_PIN(PORT_A, 6),
        .sclk_pin = GPIO_PIN(PORT_A, 5),
        .cs_pin   = GPIO_UNDEF,
        .af       = GPIO_AF5,
        .rccmask  = RCC_APB2ENR_SPI1EN,
        .apbbus   = APB2
    }
}
SPI_NUMOF
1
(sizeof(spi_config) / sizeof(spi_config[0]))
const i2c_conf_t i2c_config()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
= {
    {
        .dev            = I2C1,
        .speed          = I2C_SPEED_NORMAL,
        .scl_pin        = GPIO_PIN(PORT_B, 8),
        .sda_pin        = GPIO_PIN(PORT_B, 9),
        .scl_af         = GPIO_AF4,
        .sda_af         = GPIO_AF4,
        .bus            = APB1,
        .rcc_mask       = RCC_APB1ENR_I2C1EN,
        .clk            = CLOCK_APB1,
        .irqn           = I2C1_EV_IRQn
    },
    {
        .dev            = I2C2,
        .speed          = I2C_SPEED_NORMAL,
        .scl_pin        = GPIO_PIN(PORT_B, 10),
        .sda_pin        = GPIO_PIN(PORT_B, 11),
        .scl_af         = GPIO_AF4,
        .sda_af         = GPIO_AF4,
        .bus            = APB1,
        .rcc_mask       = RCC_APB1ENR_I2C2EN,
        .clk            = CLOCK_APB1,
        .irqn           = I2C2_EV_IRQn
    }
}
I2C_0_ISR
1
isr_i2c1_ev
I2C_1_ISR
1
isr_i2c2_ev
I2C_NUMOF
1
(sizeof(i2c_config) / sizeof(i2c_config[0]))
ADC_CONFIG
1
2
3
4
5
6
7
8
{             \
    { GPIO_PIN(PORT_A, 0), 0 },  \
    { GPIO_PIN(PORT_A, 1), 1 },  \
    { GPIO_PIN(PORT_A, 4), 4 },  \
    { GPIO_PIN(PORT_B, 0), 8 },  \
    { GPIO_PIN(PORT_C, 1), 11 }, \
    { GPIO_PIN(PORT_C, 0), 10 }, \
}
ADC_NUMOF
1
(6U)
const dac_conf_t dac_config()
1
2
3
4
= {
    { .pin = GPIO_PIN(PORT_A,  4), .chan = 0 },
    { .pin = GPIO_PIN(PORT_A,  5), .chan = 1 }
}
DAC_NUMOF
1
(sizeof(dac_config) / sizeof(dac_config[0]))