Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
074e11d
Add DISCO_L475VG_IOT specific files
bcostm Jan 25, 2017
374f71c
Add DISCO_L475VG_IOT in mbed_rtx.h
bcostm Jan 25, 2017
4cdbbca
Add DISCO_L475VG_IOT in targets.json
bcostm Jan 25, 2017
b26eae5
Add DISCO_L475VG_IOT in build, export and tests python files
bcostm Jan 25, 2017
116d35a
Update PinNames.h and remove PortNames.h after rebase with master
bcostm Jan 26, 2017
9ced451
Add target in unsupported main.cpp test files
bcostm Jan 27, 2017
0e3b3ef
DISCO_L475VG_IOT: Add ARDUINO in "supported_form_factor"
bcostm Jan 27, 2017
8c7000c
Add "01A" suffix in target name
bcostm Jan 27, 2017
23140da
Update PeripheralPins: add _ALTx pins and remove pins not available o…
bcostm Feb 7, 2017
ac27f82
Add back PB_6/PB_7 pins definition used by STDIO_UART_TX/RX
bcostm Feb 7, 2017
b9cf7db
Set ADC pins to MODE_ANALOG_ADC_CONTROL
bcostm Feb 7, 2017
2871545
Assign LED4 definition same as LED3
bcostm Feb 8, 2017
2c12c6c
Remove fat, usb_host, USB_10, USB_11 in build_travis.py
bcostm Feb 28, 2017
72e85bf
Put device_name in upper-case in targets.json
bcostm Feb 28, 2017
b40591f
DISCO_L475VG_IOT: Add USB Device files
bcostm Apr 3, 2017
a8ab839
DISCO_L475VG_IOT: Re-organize folder
bcostm Apr 3, 2017
05c023b
DISCO_L475VG_IOT01A: Add all pins even those not available on connect…
bcostm Apr 13, 2017
7a2d1bd
DISCO_L475VG_IOT01A: Move ADC internal channels in dedicated table.
bcostm Apr 27, 2017
6c585e6
DISCO_L475VG_IOT01A: add this target in i2c master/slave tests
bcostm Apr 28, 2017
2ed207e
DISCO_L475VG_IOT01A: change comment for 8-byte aligned adress for IAR…
bcostm May 3, 2017
59bfa39
DISCO_L475VG_IOT01A: remove rtos from build_travis.py
bcostm May 16, 2017
3519d53
DISCO_L475VG_IOT01A: Add generic buttons declaration
bcostm Jun 5, 2017
f6a4883
DISCO_L475VG_IOT01A: Move USB device config files
bcostm Jun 5, 2017
af2078f
DISCO_L475VG_IOT01A: Update cmsis_nvic files
bcostm Jun 5, 2017
66cbc8b
DISCO_L475VG_IOT01A: Update device files after CubeL4 update
bcostm Jun 5, 2017
8ede14d
DISCO_L475VG_IOT01A: Add include of LL timer file
bcostm Jun 12, 2017
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,145 @@
/* Copyright (c) 2016 mbed.org, MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef USBHAL_STM32L475VG
#define USBHAL_STM32L475VG

#define USBHAL_IRQn OTG_FS_IRQn


#define NB_ENDPOINT 4
/* must be multiple of 4 bytes */
#define MAXTRANSFER_SIZE 0x200
#define FIFO_USB_RAM_SIZE (MAXTRANSFER_SIZE+MAX_PACKET_SIZE_EP0+MAX_PACKET_SIZE_EP1+MAX_PACKET_SIZE_EP2+MAX_PACKET_SIZE_EP3)
#if (FIFO_USB_RAM_SIZE > 0x500)
#error "FIFO dimensioning incorrect"
#endif

typedef struct
{
USBHAL *inst;
void (USBHAL::*bus_reset)(void);
void (USBHAL::*sof)(int frame);
void (USBHAL::*connect_change)(unsigned int connected);
void (USBHAL::*suspend_change)(unsigned int suspended);
void (USBHAL::*ep0_setup)(void);
void (USBHAL::*ep0_in)(void);
void (USBHAL::*ep0_out)(void);
void (USBHAL::*ep0_read)(void);
bool (USBHAL::*ep_realise)(uint8_t endpoint, uint32_t maxPacket, uint32_t flags);
bool (USBHAL::*epCallback[2*NB_ENDPOINT-2])(void);
uint8_t epComplete[8];
/* memorize dummy buffer used for reception */
uint32_t pBufRx[MAXTRANSFER_SIZE>>2];
uint32_t pBufRx0[MAX_PACKET_SIZE_EP0>>2];
}USBHAL_Private_t;

uint32_t HAL_PCDEx_GetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo)
{
uint32_t len;
if (fifo == 0) len = hpcd->Instance->DIEPTXF0_HNPTXFSIZ>>16;
else
len = hpcd->Instance->DIEPTXF[fifo - 1] >> 16;
return len*4;
}
void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd) {
USBHAL_Private_t *priv=((USBHAL_Private_t *)(hpcd->pData));
USBHAL *obj= priv->inst;
USB_OTG_GlobalTypeDef *USBx = hpcd->Instance;
uint32_t sofnum = (USBx_DEVICE->DSTS & USB_OTG_DSTS_FNSOF) >> 8;
void (USBHAL::*func)(int frame) = priv->sof;
/* fix me call with same frame number */
(obj->*func)(sofnum);
}

USBHAL * USBHAL::instance;

USBHAL::USBHAL(void) {
/* init parameter */
USBHAL_Private_t *HALPriv = new(USBHAL_Private_t);
/* initialized all field of init including 0 field */
/* constructor does not fill with zero */
hpcd.Instance = USB_OTG_FS;
/* initialized all field of init including 0 field */
/* constructor does not fill with zero */
memset(&hpcd.Init, 0, sizeof(hpcd.Init));
hpcd.Init.dev_endpoints = NB_ENDPOINT;
hpcd.Init.ep0_mps = MAX_PACKET_SIZE_EP0;
hpcd.Init.phy_itface = PCD_PHY_EMBEDDED;
hpcd.Init.Sof_enable = 1;
hpcd.Init.speed = PCD_SPEED_FULL;
/* pass instance for usage inside call back */
HALPriv->inst = this;
HALPriv->bus_reset = &USBHAL::busReset;
HALPriv->suspend_change = &USBHAL::suspendStateChanged;
HALPriv->connect_change = &USBHAL::connectStateChanged;
HALPriv->sof = &USBHAL::SOF;
HALPriv->ep0_setup = &USBHAL::EP0setupCallback;
HALPriv->ep_realise = &USBHAL::realiseEndpoint;
HALPriv->ep0_in = &USBHAL::EP0in;
HALPriv->ep0_out = &USBHAL::EP0out;
HALPriv->ep0_read = &USBHAL::EP0read;
hpcd.pData = (void*)HALPriv;
HALPriv->epCallback[0] = &USBHAL::EP1_OUT_callback;
HALPriv->epCallback[1] = &USBHAL::EP1_IN_callback;
HALPriv->epCallback[2] = &USBHAL::EP2_OUT_callback;
HALPriv->epCallback[3] = &USBHAL::EP2_IN_callback;
HALPriv->epCallback[4] = &USBHAL::EP3_OUT_callback;
HALPriv->epCallback[5] = &USBHAL::EP3_IN_callback;
instance = this;

__HAL_RCC_PWR_CLK_ENABLE();

HAL_PWREx_EnableVddUSB();
/* Configure USB VBUS GPIO */
__HAL_RCC_GPIOC_CLK_ENABLE();

/* Configure USB FS GPIOs */
__HAL_RCC_GPIOA_CLK_ENABLE();

/* Configure DM DP Pins */
pin_function(PA_11, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF10_OTG_FS));
pin_function(PA_12, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF10_OTG_FS));

/* Configure VBUS Pin */
pin_function(PC_11, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF10_OTG_FS));

__HAL_RCC_USB_OTG_FS_CLK_ENABLE();

hpcd.State = HAL_PCD_STATE_RESET;

HAL_PCD_Init(&hpcd);
/* 1.25kbytes */
/* min value 16 (= 16 x 4 bytes) */
/* max value 256 (= 1K bytes ) */
/* maximum sum is 0x140 */
HAL_PCDEx_SetRxFiFo(&hpcd, (MAXTRANSFER_SIZE/4));
/* bulk/int 64 bytes in FS */
HAL_PCDEx_SetTxFiFo(&hpcd, 0, (MAX_PACKET_SIZE_EP0/4)+1);
/* bulk/int bytes in FS */
HAL_PCDEx_SetTxFiFo(&hpcd, 1, (MAX_PACKET_SIZE_EP1/4)+1);
HAL_PCDEx_SetTxFiFo(&hpcd, 2, (MAX_PACKET_SIZE_EP2/4));
/* ISOchronous */
HAL_PCDEx_SetTxFiFo(&hpcd, 3, (MAX_PACKET_SIZE_EP3/4));

NVIC_SetVector(USBHAL_IRQn,(uint32_t)&_usbisr);
NVIC_SetPriority( USBHAL_IRQn, 1);

HAL_PCD_Start(&hpcd);
}

#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/* Copyright (c) 2016 mbed.org, MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software
* and associated documentation files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or
* substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
* BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
* DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include "USBHAL_STM32L475VG.h"
2 changes: 1 addition & 1 deletion features/unsupported/tests/mbed/analog/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ AnalogOut out(A1);
defined(TARGET_NUCLEO_F303ZE) || \
defined(TARGET_NUCLEO_F410RB) || \
defined(TARGET_NUCLEO_F446ZE) || \
defined(TARGET_NUCLEO_F429ZI)
defined(TARGET_NUCLEO_F429ZI) || defined(TARGET_DISCO_L475VG_IOT01A)
AnalogIn in(A0);
AnalogOut out(D13);

Expand Down
2 changes: 1 addition & 1 deletion features/unsupported/tests/mbed/can/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ int main() {
!defined(TARGET_NUCLEO_F042K6) && !defined(TARGET_NUCLEO_F334R8) && \
!defined(TARGET_NUCLEO_F303RE) && !defined(TARGET_NUCLEO_F303K8) && \
!defined(TARGET_NUCLEO_F302R8) && !defined(TARGET_NUCLEO_F103RB) && \
!defined(TARGET_DISCO_L476VG) && !defined(TARGET_NUCLEO_L476RG) && \
!defined(TARGET_DISCO_L476VG) && !defined(TARGET_DISCO_L475VG_IOT01A) && !defined(TARGET_NUCLEO_L476RG) && \
!defined(TARGET_NUCLEO_L432KC)) && !defined(TARGET_DISCO_F303VC)
printf("loop()\n");
if(can2.read(msg)) {
Expand Down
2 changes: 1 addition & 1 deletion features/unsupported/tests/mbed/can_interrupt/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ void send() {
!defined(TARGET_NUCLEO_F042K6) && !defined(TARGET_NUCLEO_F334R8) && \
!defined(TARGET_NUCLEO_F303RE) && !defined(TARGET_NUCLEO_F303K8) && \
!defined(TARGET_NUCLEO_F302R8) && !defined(TARGET_NUCLEO_F103RB) && \
!defined(TARGET_DISCO_L476VG) && !defined(TARGET_NUCLEO_L476RG) && \
!defined(TARGET_DISCO_L476VG) && !defined(TARGET_DISCO_L475VG_IOT01A) && !defined(TARGET_NUCLEO_L476RG) && \
!defined(TARGET_NUCLEO_L432KC) && !defined(TARGET_DISCO_F303VC))
void read() {
CANMessage msg;
Expand Down
2 changes: 1 addition & 1 deletion features/unsupported/tests/mbed/can_loopback/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ CAN can1(P5_9, P5_10);
defined(TARGET_NUCLEO_F303RE) || defined(TARGET_NUCLEO_F303K8) || \
defined(TARGET_NUCLEO_F302R8) || defined(TARGET_NUCLEO_F446RE) || \
defined(TARGET_DISCO_F429ZI) || \
defined(TARGET_NUCLEO_F746ZG) || defined(TARGET_DISCO_L476VG) || \
defined(TARGET_NUCLEO_F746ZG) || defined(TARGET_DISCO_L476VG) || defined(TARGET_DISCO_L475VG_IOT01A) || \
defined(TARGET_NUCLEO_F412ZG) || \
defined(TARGET_NUCLEO_L476RG) || defined(TARGET_NUCLEO_L432KC)
CAN can1(PA_11, PA_12);
Expand Down
3 changes: 3 additions & 0 deletions features/unsupported/tests/mbed/i2c_master_slave/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ I2CSlave slave(D2, D4);
defined (TARGET_NUCLEO_F072RB)
I2CSlave slave(PB_11, D6);

#elif defined (TARGET_DISCO_L475VG_IOT01A)
I2CSlave slave(A4, A5);

#else
I2CSlave slave(D3, D6);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ I2C master(D14, D15); // I2C_SDA, I2C_SCL
I2CSlave slave(PB_11, PB_10);
#elif defined(TARGET_NUCLEO_F303RE)
I2CSlave slave(D2, D8);
#elif defined (TARGET_DISCO_L475VG_IOT01A)
I2CSlave slave(A4, A5);
#else
I2CSlave slave(D3, D6);
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
/* mbed Microcontroller Library
*******************************************************************************
* Copyright (c) 2017, STMicroelectronics
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*******************************************************************************
*/
#ifndef MBED_PERIPHERALNAMES_H
#define MBED_PERIPHERALNAMES_H

#include "cmsis.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef enum {
ADC_1 = (int)ADC1_BASE,
ADC_2 = (int)ADC2_BASE,
ADC_3 = (int)ADC3_BASE
} ADCName;

typedef enum {
DAC_1 = (int)DAC_BASE
} DACName;

typedef enum {
UART_1 = (int)USART1_BASE,
UART_2 = (int)USART2_BASE,
UART_3 = (int)USART3_BASE,
UART_4 = (int)UART4_BASE,
UART_5 = (int)UART5_BASE,
LPUART_1 = (int)LPUART1_BASE
} UARTName;

#define STDIO_UART_TX PB_6
#define STDIO_UART_RX PB_7
#define STDIO_UART UART_1

typedef enum {
SPI_1 = (int)SPI1_BASE,
SPI_2 = (int)SPI2_BASE,
SPI_3 = (int)SPI3_BASE
} SPIName;

typedef enum {
I2C_1 = (int)I2C1_BASE,
I2C_2 = (int)I2C2_BASE,
I2C_3 = (int)I2C3_BASE
} I2CName;

typedef enum {
PWM_1 = (int)TIM1_BASE,
PWM_2 = (int)TIM2_BASE,
PWM_3 = (int)TIM3_BASE,
PWM_4 = (int)TIM4_BASE,
PWM_5 = (int)TIM5_BASE,
PWM_8 = (int)TIM8_BASE,
PWM_15 = (int)TIM15_BASE,
PWM_16 = (int)TIM16_BASE,
PWM_17 = (int)TIM17_BASE
} PWMName;

typedef enum {
CAN_1 = (int)CAN1_BASE
} CANName;

#ifdef __cplusplus
}
#endif

#endif
Loading