arch/arm/src/stm32l4: Fix ADC and COMP breakage caused by CONFIG_STM32L4_STM32L4X2 separation in 9223123c

This commit is contained in:
Juha Niskanen 2018-08-08 06:55:25 -06:00 committed by Gregory Nutt
parent a876f58a10
commit 84f8e01c17
7 changed files with 50 additions and 28 deletions

View File

@ -403,7 +403,7 @@ config STM32L4_STM32L4X2
select ARCH_HAVE_FPU
select STM32L4_HAVE_USART1
select STM32L4_HAVE_USART2
select STM32L4_HAVE_UART3
select STM32L4_HAVE_USART3 if !(STM32L4_L432XX || STM32L4_L442XX)
select STM32L4_HAVE_LPTIM1
select STM32L4_HAVE_LPTIM2
select STM32L4_HAVE_COMP
@ -415,12 +415,12 @@ config STM32L4_STM32L4X3
select ARCH_HAVE_FPU
select STM32L4_HAVE_USART1
select STM32L4_HAVE_USART2
select STM32L4_HAVE_USART3 if !(STM32L4_L432XX || STM32L4_L442XX)
select STM32L4_HAVE_USART3
select STM32L4_HAVE_LPTIM1
select STM32L4_HAVE_LPTIM2
select STM32L4_HAVE_COMP
select STM32L4_HAVE_SAI1
select STM32L4_HAVE_LCD if !(STM32L4_STM32L4X1 || STM32L4_STM32L4X2)
select STM32L4_HAVE_LCD if !STM32L4_STM32L4X1
config STM32L4_STM32L4X5
bool

View File

@ -1,9 +1,32 @@
This is a port of NuttX to the STM32L4 Family
Used development boards are the Nucleo L476RG, Nucleo L496ZG,
Nucleo L452RE and STM32L4VGDiscovery.
Nucleo L452RE, Nucleo L432KC, STM32L4VG Discovery and
Motorola MDK.
Most code is copied and adapted from the STM32 and STM32F7 ports.
The various supported STM32L4 families are:
-------------------------------------------------------------
| NuttX config | Manual | Chips
|
| Not supported | RM0392 | STM32L471xx
|
| STM32L4_STM32L4X1 | RM0394 | Subset of STM32L4_STM32L4X3
|
| STM32L4_STM32L4X2 | RM0394 | Subset of STM32L4_STM32L4X3
|
| STM32L4_STM32L4X3 | RM0394 | STM32L43xxx/44xxx/45xxx/46xxx
|
| STM32L4_STM32L4X5 | RM0351 | STM32L475xx (was RM0395 in past)
|
| STM32L4_STM32L4X6 | RM0351 | STM32L476xx, STM32L486xx,
| STM32L496xx, STM32L4A6xx
|
| Not supported | RM0432 | STM32L4Rxxx, STM32L4Sxxx
-------------------------------------------------------------
Most code is copied and adapted from the STM32 Port.
TODO list
---------
@ -12,7 +35,7 @@ Peripherals with implementation in STM32 port:
IRQs : OK
GPIO : OK
EXTI : OK, to be tested.
EXTI : OK
HSI : OK
HSE : OK
PLL : Works @ 80 MHz
@ -24,8 +47,8 @@ USART : Working in normal mode (no DMA, to be tested, code is written)
DMA : works; at least tested with QSPI
SRAM2 : OK; can be included in MM region or left separate for special app
: purposes
SPI : OK, tested (Including DMA)
I2C : Code written, to be tested
SPI : OK, tested (including DMA)
I2C : works
RTC : works
QSPI : works in polling, interrupt, DMA, and also memory-mapped modes
CAN : OK, tested
@ -42,12 +65,12 @@ RNG : works
CRC : TODO (configurable polynomial)
WWDG : TODO
IWDG : works
MMCSD : TODO
ADC : Code written, to be tested
DAC : Code written, to be tested
SDMMC : works
ADC : works
DAC : works
DMA2D : TODO (Chrom-Art Accelerator for image manipulation)
New peripherals with implementation to be written from scratch
New peripherals with implementation to be written from scratch.
These are Low Priority TODO items, unless someone requests or contributes
it.

View File

@ -59,6 +59,7 @@
#include "stm32l4_adc.h"
#include "stm32l4_can.h"
#include "stm32l4_comp.h"
#include "stm32l4_dac.h"
#include "stm32l4_dbgmcu.h"
#include "stm32l4_dma.h"
#include "stm32l4_exti.h"

View File

@ -76,13 +76,14 @@
#if defined(CONFIG_STM32L4_ADC1) || defined(CONFIG_STM32L4_ADC2) || \
defined(CONFIG_STM32L4_ADC3)
/* This implementation is for the STM32L4X3 and STM32L4X6 only */
#if !(defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3) || \
defined(CONFIG_STM32L4_STM32L4X6))
# error "Unrecognized STM32 chip"
#endif
#if defined(CONFIG_STM32L4_STM32L4X3) || defined(CONFIG_STM32L4_STM32L4X6)
#if defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
# if defined(CONFIG_STM32L4_ADC2) || defined(CONFIG_STM32L4_ADC3)
# error "Using non-existent ADC on STM32L4X3"
# error "Using non-existent ADC"
# endif
#endif
@ -104,7 +105,7 @@
/* ADC interrupts ***********************************************************/
#if defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
# define STM32L4_IRQ_ADC12 STM32L4_IRQ_ADC1
#endif
@ -2034,6 +2035,5 @@ struct adc_dev_s *stm32l4_adc_initialize(int intf, FAR const uint8_t *chanlist,
return dev;
}
#endif /* CONFIG_STM32L4_STM32L4X3 || CONFIG_STM32L4_STM32L4X6 */
#endif /* CONFIG_STM32L4_ADC1 || CONFIG_STM32L4_ADC2 || CONFIG_STM32L4_ADC3 */
#endif /* CONFIG_ADC */

View File

@ -1,5 +1,4 @@
/****************************************************************************
* arch/arm/src/stm32l4/stm32l4_comp.c
*
* Copyright (c) 2017 Gregory Nutt. All rights reserved.
@ -38,7 +37,6 @@
****************************************************************************/
/****************************************************************************
* Included Files
****************************************************************************/
@ -56,8 +54,8 @@
#include <errno.h>
#if !(defined(CONFIG_STM32L4_STM32L4X3) || defined(CONFIG_STM32L4_STM32L4X5) || \
defined(CONFIG_STM32L4_STM32L4X6))
#if !(defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3) || \
defined(CONFIG_STM32L4_STM32L4X5) || defined(CONFIG_STM32L4_STM32L4X6))
# error "Unrecognized STM32 chip"
#endif
@ -375,7 +373,7 @@ static int stm32l4_compconfig(FAR const struct comp_dev_s *dev)
regval |= COMP_CSR_INPSEL_PIN2;
break;
#if defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
case STM32L4_COMP_INP_PIN_3:
stm32l4_configgpio(cmp == STM32L4_COMP1 ? GPIO_COMP1_INP_3 : GPIO_COMP2_INP_3);
regval |= COMP_CSR_INPSEL_PIN3;
@ -439,7 +437,7 @@ static int stm32l4_compconfig(FAR const struct comp_dev_s *dev)
#endif
break;
#if defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
case STM32L4_COMP_INM_PIN_3:
stm32l4_configgpio(cmp == STM32L4_COMP1 ? GPIO_COMP1_INM_3 : GPIO_COMP2_INM_3);
regval |= COMP_CSR_INMSEL_INMESEL;

View File

@ -50,7 +50,7 @@
* Public Types
************************************************************************************/
#if defined(CONFIG_STM32L4_STM32L4X3)
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3)
/* Comparators */

View File

@ -69,8 +69,8 @@ static struct comp_callback_s g_comp_handlers[STM32L4_COMP_NUM];
static const uint32_t g_comp_lines[STM32L4_COMP_NUM] =
{
#if defined(CONFIG_STM32L4_STM32L4X3) || defined (CONFIG_STM32L4_STM32L4X5) || \
defined(CONFIG_STM32L4_STM32L4X6)
#if defined(CONFIG_STM32L4_STM32L4X2) || defined(CONFIG_STM32L4_STM32L4X3) || \
defined(CONFIG_STM32L4_STM32L4X5) || defined(CONFIG_STM32L4_STM32L4X6)
EXTI1_COMP1,
EXTI1_COMP2
#else