Skip to content

Commit 7a35a4d

Browse files
authored
Merge pull request #3992 from u-blox/c030-dev
Introducing UBLOX_C030 platform.
2 parents 1069dfc + 7387c09 commit 7a35a4d

File tree

22 files changed

+20992
-0
lines changed

22 files changed

+20992
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
#include "stm32f4xx_hal.h"
2+
3+
/**
4+
* Override HAL Eth Init function
5+
*/
6+
void HAL_ETH_MspInit(ETH_HandleTypeDef* heth)
7+
{
8+
GPIO_InitTypeDef GPIO_InitStructure;
9+
if (heth->Instance == ETH) {
10+
11+
/* Enable GPIOs clocks */
12+
__HAL_RCC_GPIOA_CLK_ENABLE();
13+
__HAL_RCC_GPIOB_CLK_ENABLE();
14+
__HAL_RCC_GPIOC_CLK_ENABLE();
15+
16+
/** ETH GPIO Configuration
17+
RMII_REF_CLK ----------------------> PA1
18+
RMII_MDIO -------------------------> PA2
19+
RMII_MDC --------------------------> PC1
20+
RMII_MII_CRS_DV -------------------> PA7
21+
RMII_MII_RXD0 ---------------------> PC4
22+
RMII_MII_RXD1 ---------------------> PC5
23+
RMII_MII_RXER ---------------------> PG2
24+
RMII_MII_TX_EN --------------------> PB11
25+
RMII_MII_TXD0 ---------------------> PB12
26+
RMII_MII_TXD1 ---------------------> PB13
27+
*/
28+
/* Configure PA1, PA2 and PA7 */
29+
GPIO_InitStructure.Speed = GPIO_SPEED_HIGH;
30+
GPIO_InitStructure.Mode = GPIO_MODE_AF_PP;
31+
GPIO_InitStructure.Pull = GPIO_PULLUP;
32+
GPIO_InitStructure.Pin = GPIO_PIN_2 | GPIO_PIN_7;
33+
GPIO_InitStructure.Alternate = GPIO_AF11_ETH;
34+
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
35+
36+
GPIO_InitStructure.Pull = GPIO_NOPULL;
37+
GPIO_InitStructure.Pin = GPIO_PIN_1;
38+
HAL_GPIO_Init(GPIOA, &GPIO_InitStructure);
39+
40+
/* Configure PB13 */
41+
GPIO_InitStructure.Pin = GPIO_PIN_13 | GPIO_PIN_11 | GPIO_PIN_12;
42+
HAL_GPIO_Init(GPIOB, &GPIO_InitStructure);
43+
44+
/* Configure PC1, PC4 and PC5 */
45+
GPIO_InitStructure.Pin = GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5;
46+
HAL_GPIO_Init(GPIOC, &GPIO_InitStructure);
47+
48+
49+
/* Enable the Ethernet global Interrupt */
50+
HAL_NVIC_SetPriority(ETH_IRQn, 0x7, 0);
51+
HAL_NVIC_EnableIRQ(ETH_IRQn);
52+
53+
/* Enable ETHERNET clock */
54+
__HAL_RCC_ETH_CLK_ENABLE();
55+
}
56+
}
57+
58+
/**
59+
* Override HAL Eth DeInit function
60+
*/
61+
void HAL_ETH_MspDeInit(ETH_HandleTypeDef* heth)
62+
{
63+
if (heth->Instance == ETH) {
64+
/* Peripheral clock disable */
65+
__HAL_RCC_ETH_CLK_DISABLE();
66+
67+
/** ETH GPIO Configuration
68+
RMII_REF_CLK ----------------------> PA1
69+
RMII_MDIO -------------------------> PA2
70+
RMII_MDC --------------------------> PC1
71+
RMII_MII_CRS_DV -------------------> PA7
72+
RMII_MII_RXD0 ---------------------> PC4
73+
RMII_MII_RXD1 ---------------------> PC5
74+
RMII_MII_RXER ---------------------> PG2
75+
RMII_MII_TX_EN --------------------> PB11
76+
RMII_MII_TXD0 ---------------------> PB12
77+
RMII_MII_TXD1 ---------------------> PB13
78+
*/
79+
HAL_GPIO_DeInit(GPIOA, GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_7);
80+
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_13 | GPIO_PIN_11 | GPIO_PIN_12);
81+
HAL_GPIO_DeInit(GPIOC, GPIO_PIN_1 | GPIO_PIN_4 | GPIO_PIN_5);
82+
83+
/* Disable the Ethernet global Interrupt */
84+
NVIC_DisableIRQ(ETH_IRQn);
85+
}
86+
}
Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/* mbed Microcontroller Library
2+
*******************************************************************************
3+
* Copyright (c) 2015, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
* may be used to endorse or promote products derived from this software
16+
* without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*******************************************************************************
29+
*/
30+
#ifndef MBED_PERIPHERALNAMES_H
31+
#define MBED_PERIPHERALNAMES_H
32+
33+
#include "cmsis.h"
34+
35+
#ifdef __cplusplus
36+
extern "C" {
37+
#endif
38+
39+
typedef enum {
40+
ADC_1 = (int)ADC1_BASE,
41+
ADC_2 = (int) ADC2_BASE,
42+
ADC_3 = (int) ADC3_BASE
43+
} ADCName;
44+
45+
46+
typedef enum {
47+
UART_1 = (int)USART1_BASE,
48+
UART_2 = (int)USART2_BASE,
49+
UART_3 = (int)USART3_BASE,
50+
UART_4 = (int)UART4_BASE,
51+
UART_5 = (int)UART5_BASE,
52+
UART_6 = (int)USART6_BASE,
53+
UART_7 = (int)UART7_BASE,
54+
UART_8 = (int)UART8_BASE
55+
} UARTName;
56+
57+
#define STDIO_UART_TX PA_9
58+
#define STDIO_UART_RX PA_10
59+
#define STDIO_UART UART_1
60+
61+
typedef enum {
62+
SPI_1 = (int)SPI1_BASE,
63+
SPI_2 = (int)SPI2_BASE,
64+
SPI_3 = (int)SPI3_BASE,
65+
SPI_4 = (int)SPI4_BASE,
66+
SPI_5 = (int)SPI5_BASE,
67+
SPI_6 = (int)SPI6_BASE
68+
} SPIName;
69+
70+
typedef enum {
71+
I2C_1 = (int)I2C1_BASE,
72+
I2C_2 = (int)I2C2_BASE,
73+
I2C_3 = (int)I2C3_BASE
74+
} I2CName;
75+
76+
typedef enum {
77+
PWM_1 = (int)TIM1_BASE,
78+
PWM_2 = (int)TIM2_BASE,
79+
PWM_3 = (int)TIM3_BASE,
80+
PWM_4 = (int)TIM4_BASE,
81+
PWM_5 = (int)TIM5_BASE,
82+
PWM_8 = (int)TIM8_BASE,
83+
PWM_9 = (int)TIM9_BASE,
84+
PWM_10 = (int)TIM10_BASE,
85+
PWM_11 = (int)TIM11_BASE,
86+
PWM_12 = (int)TIM12_BASE,
87+
PWM_13 = (int)TIM13_BASE,
88+
PWM_14 = (int)TIM14_BASE
89+
} PWMName;
90+
91+
typedef enum {
92+
DAC_1 = (int)DAC_BASE
93+
} DACName;
94+
95+
typedef enum {
96+
CAN_1 = (int)CAN1_BASE,
97+
CAN_2 = (int)CAN2_BASE
98+
} CANName;
99+
100+
#ifdef __cplusplus
101+
}
102+
#endif
103+
104+
#endif
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
/* mbed Microcontroller Library
2+
*******************************************************************************
3+
* Copyright (c) 2014, STMicroelectronics
4+
* All rights reserved.
5+
*
6+
* Redistribution and use in source and binary forms, with or without
7+
* modification, are permitted provided that the following conditions are met:
8+
*
9+
* 1. Redistributions of source code must retain the above copyright notice,
10+
* this list of conditions and the following disclaimer.
11+
* 2. Redistributions in binary form must reproduce the above copyright notice,
12+
* this list of conditions and the following disclaimer in the documentation
13+
* and/or other materials provided with the distribution.
14+
* 3. Neither the name of STMicroelectronics nor the names of its contributors
15+
* may be used to endorse or promote products derived from this software
16+
* without specific prior written permission.
17+
*
18+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
22+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
25+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28+
*******************************************************************************
29+
*/
30+
31+
#include "PeripheralPins.h"
32+
// =====
33+
// Note: Commented lines are alternative possibilities which are not used per default.
34+
// If you change them, you will have also to modify the corresponding xxx_api.c file
35+
// for pwmout, analogin, analogout, ...
36+
// =====
37+
38+
//*** ADC ***
39+
40+
const PinMap PinMap_ADC[] = {
41+
{PA_3, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 3, 0)}, // ADC1_IN3
42+
{PA_4, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 4, 0)}, // ADC1_IN4
43+
{PA_6, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 6, 0)}, // ADC1_IN6
44+
{PB_0, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 8, 0)}, // ADC1_IN8
45+
{PC_0, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 10, 0)}, // ADC1_IN10
46+
{PC_3, ADC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 13, 0)}, // ADC1_IN13
47+
{NC, NC, 0}
48+
};
49+
50+
//*** I2C ***
51+
52+
53+
const PinMap PinMap_I2C_SDA[] = {
54+
{PB_7, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
55+
{PC_9, I2C_3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
56+
{NC, NC, 0}
57+
};
58+
59+
const PinMap PinMap_I2C_SCL[] = {
60+
{PB_6, I2C_1, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C1)},
61+
{PA_8, I2C_3, STM_PIN_DATA(STM_MODE_AF_OD, GPIO_NOPULL, GPIO_AF4_I2C3)},
62+
{NC, NC, 0}
63+
};
64+
65+
const PinMap PinMap_DAC[] = {
66+
{PA_5, DAC_1, STM_PIN_DATA_EXT(STM_MODE_ANALOG, GPIO_NOPULL, 0, 2, 0)}, // DAC_OUT2 - ARDUINO D13
67+
{NC, NC, 0}
68+
};
69+
70+
//*** PWM ***
71+
72+
const PinMap PinMap_PWM[] = {
73+
{PE_13, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 3, 0)}, // TIM1_CH3
74+
{PE_9, PWM_1, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF1_TIM1, 1, 0)}, // TIM1_CH1N
75+
{PB_1, PWM_3, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM3, 4, 0)}, // TIM3_CH4
76+
{PD_12, PWM_4, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF2_TIM4, 1, 0)}, // TIM4_CH1
77+
{PB_8, PWM_10, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF3_TIM10, 1, 0)}, // TIM10_CH1
78+
{PB_15, PWM_12, STM_PIN_DATA_EXT(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF9_TIM12, 2, 0)}, // TIM12_CH2
79+
{NC, NC, 0}
80+
};
81+
82+
//*** SERIAL ***
83+
84+
const PinMap PinMap_UART_TX[] = {
85+
{PA_9, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
86+
{PD_5, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
87+
{PD_9, UART_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
88+
{PC_6, UART_6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
89+
{NC, NC, 0}
90+
};
91+
92+
const PinMap PinMap_UART_RX[] = {
93+
{PA_10, UART_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART1)},
94+
{PD_6, UART_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART2)},
95+
{PD_8, UART_3, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF7_USART3)},
96+
{PC_7, UART_6, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF8_USART6)},
97+
{NC, NC, 0}
98+
};
99+
100+
//*** SPI ***
101+
102+
const PinMap PinMap_SPI_MOSI[] = {
103+
{PE_6, SPI_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)},
104+
{NC, NC, 0}
105+
};
106+
107+
const PinMap PinMap_SPI_MISO[] = {
108+
{PE_5, SPI_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)},
109+
{NC, NC, 0}
110+
};
111+
112+
const PinMap PinMap_SPI_SCLK[] = {
113+
{PE_2, SPI_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF5_SPI4)},
114+
{NC, NC, 0}
115+
};
116+
117+
const PinMap PinMap_SPI_SSEL[] = {
118+
{PE_11, SPI_4, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF5_SPI4)},
119+
{NC, NC, 0}
120+
};

0 commit comments

Comments
 (0)