Problem with uart_lld.c
Moderator: RoccoMarco
-
Giapptvn1412
- Posts: 7
- Joined: Mon Nov 14, 2016 12:04 pm
Problem with uart_lld.c
Am I not configuring something correctly here? when i wirte #include "hal.h" in the file uart_lld.c. Keil C error I2c2 not present in the selected device.
Who can answer me? Thank you very much
Who can answer me? Thank you very much
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Problem with uart_lld.c
Hi,
Just read this part "I2c2 not present in the selected device".
Disable I2C2 in mcuconf.h.
Giovanni
Just read this part "I2c2 not present in the selected device".
Disable I2C2 in mcuconf.h.
Giovanni
-
Giapptvn1412
- Posts: 7
- Joined: Mon Nov 14, 2016 12:04 pm
Re: Problem with uart_lld.c
Can i init I2c2 if disable i2c2 in mcuconfig.h. my understanding, is enabled I2C2 when #define STM32_HAS_I2C2 TRUE and #define STM32_I2C_USE_I2C2 TRUE
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Problem with uart_lld.c
Apparently your device does not have I2C2 so you cannot initialize it.
Giovanni
Giovanni
-
Giapptvn1412
- Posts: 7
- Joined: Mon Nov 14, 2016 12:04 pm
Re: Problem with uart_lld.c
Thank you for the answer. . My Device STM32F103s8t6. I want to initialize the I2С2. How to enable the I2C2 to use slave? I'm sory, I'm new to chibios.
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Problem with uart_lld.c
Hi,
The STM32F103T6 does not have I2C2.
http://www.st.com/content/st_com/en/pro ... 103t6.html
Giovanni
The STM32F103T6 does not have I2C2.
http://www.st.com/content/st_com/en/pro ... 103t6.html
Giovanni
-
Giapptvn1412
- Posts: 7
- Joined: Mon Nov 14, 2016 12:04 pm
Re: Problem with uart_lld.c
Hi. I think there's something.
STM32F103C8T6 has I2C2.
http://www.st.com/content/st_com/en/pro ... 103c8.html
STM32F103C8T6 has I2C2.
http://www.st.com/content/st_com/en/pro ... 103c8.html
- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Problem with uart_lld.c
Hi,
Do you have a custom board.h?
Make sure to define STM32F103xB in board.h, x8 devices are not directly supported, xB are the closest ones.
Giovanni
Do you have a custom board.h?
Make sure to define STM32F103xB in board.h, x8 devices are not directly supported, xB are the closest ones.
Giovanni
-
Giapptvn1412
- Posts: 7
- Joined: Mon Nov 14, 2016 12:04 pm
Re: Problem with uart_lld.c
Code: Select all
#ifndef _BOARD_H_
#define _BOARD_H_
/*
* Setup for STM32F1 board.
*/
/*
* Board identifier.
*/
#define BOARD_KOSAGI_STM32F1_SENOKO
#define BOARD_NAME " STM32F103C8T6"
/*
* Board oscillators-related settings.
* NOTE: HSE not fitted.
*/
#if !defined(STM32_LSECLK)
#define STM32_LSECLK 32768
#endif
#if !defined(STM32_HSECLK)
#define STM32_HSECLK 0
#endif
/*
* Board voltages.
* Required for performance limits calculation.
*/
#define STM32_VDD 330
/*
* MCU type as defined in the ST header file stm32f1xx.h.
*/
#define STM32F10X_MD
/*
* IO pins assignments.
*/
#define PA0 0
#define PA1 1
#define PA2 2
#define PA3 3
#define PA4 4
#define PA5 5
#define PA6 6
#define PA7 7
#define PA8 8
#define PA9 9
#define PA10 10
#define PA11 11
#define PA12 12
#define PA13 13
#define PA14 14
#define PA15 15
#define PB0 0
#define PB1 1
#define PB2 2
#define PB3 3
#define PB4 4
#define PB5 5
#define PB6 6
#define PB7 7
#define PB8 8
#define PB9 9
#define PB10 10
#define PB11 11
#define PB12 12
#define PB13 13
#define PB14 14
#define PB15 15
#define PC0 0
#define PC1 1
#define PC2 2
#define PC3 3
#define PC4 4
#define PC5 5
#define PC6 6
#define PC7 7
#define PC8 8
#define PC9 9
#define PC10 10
#define PC11 11
#define PC12 12
#define PC13 13
#define PC14 14
#define PC15 15
#define PD0 0
#define PD1 1
#define PD2 2
#define PD3 3
#define PD4 4
#define PD5 5
#define PD6 6
#define PD7 7
#define PD8 8
#define PD9 9
#define PD10 10
#define PD11 11
#define PD12 12
#define PD13 13
#define PD14 14
#define PD15 15
#define PE0 0
#define PE1 1
#define PE2 2
#define PE3 3
#define PE4 4
#define PE5 5
#define PE6 6
#define PE7 7
#define PE8 8
#define PE9 9
#define PE10 10
#define PE11 11
#define PE12 12
#define PE13 13
#define PE14 14
#define PE15 15
/*
* I/O ports initial setup, this configuration is established soon after reset
* in the initialization code.
* Please refer to the STM32 Reference Manual for details.
*/
#define PIN_OSPEED_INPUT(n) (0U << (((n) & 7) * 4))
#define PIN_OSPEED_10M(n) (1U << (((n) & 7) * 4))
#define PIN_OSPEED_2M(n) (2U << (((n) & 7) * 4))
#define PIN_OSPEED_50M(n) (3U << (((n) & 7) * 4))
/* Input (cnf) */
#define PIN_MODE_ANALOG(n) (0U << ((((n) & 7) * 4) + 2))
#define PIN_MODE_FLOATING(n) (1U << ((((n) & 7) * 4) + 2))
#define PIN_MODE_INPUT(n) (2U << ((((n) & 7) * 4) + 2))
/* Output (cnf) */
#define PIN_OTYPE_PUSHPULL(n) (0U << ((((n) & 7) * 4) + 2))
#define PIN_OTYPE_OPENDRAIN(n) (1U << ((((n) & 7) * 4) + 2))
#define PIN_OTYPE_AF_PUSHPULL(n) (2U << ((((n) & 7) * 4) + 2))
#define PIN_OTYPE_AF_OPENDRAIN(n) (3U << ((((n) & 7) * 4) + 2))
/* Set not-present pins to floating inputs */
#define PIN_NOTPRESENT(n) (4U << (((n) & 7) * 4))
#define PIN_UNUSED(n) PIN_NOTPRESENT(n)
/* Output data (ODR) */
#define PIN_ODR_HIGH(n) (1U << ((n) & 7))
#define PIN_ODR_LOW(n)
#define VAL_GPIOA_CRL ( 0 \
\
/* CHG_CRIT */ \
| PIN_OSPEED_INPUT(PA0) \
| PIN_MODE_FLOATING(PA0) \
\
| PIN_UNUSED(PA1) \
| PIN_UNUSED(PA2) \
| PIN_UNUSED(PA3) \
\
/* ANA_METER */ \
| PIN_OSPEED_INPUT(PA4) \
| PIN_MODE_ANALOG(PA4) \
\
/* ADC_IN5 */ \
| PIN_OSPEED_INPUT(PA5) \
| PIN_MODE_ANALOG(PA5) \
\
/* ADC_IN6 */ \
| PIN_OSPEED_INPUT(PA6) \
| PIN_MODE_ANALOG(PA6) \
\
/* ADC_IN7 */ \
| PIN_OSPEED_INPUT(PA7) \
| PIN_MODE_ANALOG(PA7) \
\
| 0)
#define VAL_GPIOA_CRH ( 0 \
/* CHG_ACOK */ \
| PIN_OSPEED_INPUT(PA8) \
| PIN_MODE_FLOATING(PA8) \
\
/* USART1_TX */ \
| PIN_OSPEED_2M(PA9) \
| PIN_OTYPE_AF_PUSHPULL(PA9) \
\
/* USART1_RX */ \
| PIN_OSPEED_INPUT(PA10) \
| PIN_MODE_FLOATING(PA10) \
\
/* GG_SYSPRES */ \
| PIN_OSPEED_2M(PA11) \
| PIN_OTYPE_PUSHPULL(PA11) \
\
/* CHG_CE */ \
| PIN_OSPEED_2M(PA12) \
| PIN_OTYPE_PUSHPULL(PA12) \
\
/* CHG_PWRSWITCH2 (formerly JTMS-SWDIO) */ \
| PIN_OSPEED_INPUT(PA13) \
| PIN_MODE_FLOATING(PA13) \
\
/* JTCK / SWCLK */ \
| PIN_OSPEED_INPUT(PA14) \
| PIN_MODE_FLOATING(PA14) \
\
/* JTDI */ \
| PIN_OSPEED_INPUT(PA15) \
| PIN_MODE_FLOATING(PA15) \
\
| 0)
/*
* Pull GG_SYSPRES low to enable gas gauge,
* and CHG_CE high to enable charging
*/
#define VAL_GPIOA_ODR (( 0U << 11 ) | ( 1U << 12 ))
#define VAL_GPIOB_CRL ( 0 \
\
/* CHG_ICOUT */ \
| PIN_OSPEED_INPUT(PB0) \
| PIN_MODE_FLOATING(PB0) \
\
/* NC */ \
| PIN_UNUSED(PB1) \
\
/* Programming mode */ \
| PIN_UNUSED(PB2) \
\
/* PM_JTDO */ \
| PIN_OSPEED_2M(PB3) \
| PIN_OTYPE_OPENDRAIN(PB3) \
\
/* PM_JRST */ \
| PIN_OSPEED_INPUT(PB4) \
| PIN_MODE_FLOATING(PB4) \
\
/* NC */ \
| PIN_UNUSED(PB5) \
| PIN_UNUSED(PB6) \
| PIN_UNUSED(PB7) \
\
| 0)
#define VAL_GPIOB_CRH ( 0 \
\
/* PM_REFLASH_ALRT */ \
| PIN_UNUSED(PB8) \
\
/* NC */ \
| PIN_UNUSED(PB9) \
\
/* CHG_SCL */ \
| PIN_OSPEED_2M(PB10) \
| PIN_OTYPE_AF_OPENDRAIN(PB10) \
\
/* CHG_SDA */ \
| PIN_OSPEED_2M(PB11) \
| PIN_OTYPE_AF_OPENDRAIN(PB11) \
\
/* CHG_ALERT */ \
| PIN_OSPEED_INPUT(PB12) \
| PIN_MODE_INPUT(PB12) \
\
/* NC */ \
| PIN_UNUSED(PB13) \
\
/* CHG_PWRSWITCH */ \
| PIN_OSPEED_INPUT(PB14) \
| PIN_MODE_FLOATING(PB14) \
\
/* CHG_MASTERPWR */ \
| PIN_OSPEED_2M(PB15) \
| PIN_OTYPE_PUSHPULL(PB15) \
\
| 0 )
/* master power (PB15) on */
/* Pull alert (PB15) high */
/* Pull CHG_PWRSWITCH_EXT (PB3) high */
#define VAL_GPIOB_ODR ((1U << 15) | (1U << 12) | (1U << 3))
#define VAL_GPIOC_CRL ( 0 \
| PIN_NOTPRESENT(PC0) \
| PIN_NOTPRESENT(PC1) \
| PIN_NOTPRESENT(PC2) \
| PIN_NOTPRESENT(PC3) \
| PIN_NOTPRESENT(PC4) \
| PIN_NOTPRESENT(PC5) \
| PIN_NOTPRESENT(PC6) \
| PIN_NOTPRESENT(PC7) \
)
#define VAL_GPIOC_CRH ( 0 \
| PIN_NOTPRESENT(PC8) \
| PIN_NOTPRESENT(PC9) \
| PIN_NOTPRESENT(PC10) \
| PIN_NOTPRESENT(PC11) \
| PIN_NOTPRESENT(PC12) \
\
/* TAMPER-RTC */ \
| PIN_UNUSED(PC13) \
\
/* PM_OSC32_IN */ \
| PIN_OSPEED_INPUT(PC14) \
| PIN_MODE_INPUT(PC14) \
\
/* PM_OSC32_OUT */ \
| PIN_OSPEED_INPUT(PC15) \
| PIN_MODE_INPUT(PC15) \
\
| 0)
#define VAL_GPIOC_ODR 0
#define VAL_GPIOD_CRL ( 0 \
| PIN_UNUSED(PD0) \
| PIN_UNUSED(PD1) \
| PIN_NOTPRESENT(PD2) \
| PIN_NOTPRESENT(PD3) \
| PIN_NOTPRESENT(PD4) \
| PIN_NOTPRESENT(PD5) \
| PIN_NOTPRESENT(PD6) \
| PIN_NOTPRESENT(PD7) \
| 0)
#define VAL_GPIOD_CRH ( 0 \
| PIN_NOTPRESENT(PD8) \
| PIN_NOTPRESENT(PD9) \
| PIN_NOTPRESENT(PD10) \
| PIN_NOTPRESENT(PD11) \
| PIN_NOTPRESENT(PD12) \
| PIN_NOTPRESENT(PD13) \
| PIN_NOTPRESENT(PD14) \
| PIN_NOTPRESENT(PD15) \
| 0)
#define VAL_GPIOD_ODR 0
#define VAL_GPIOE_CRL ( 0 \
| PIN_NOTPRESENT(PE0) \
| PIN_NOTPRESENT(PE1) \
| PIN_NOTPRESENT(PE2) \
| PIN_NOTPRESENT(PE3) \
| PIN_NOTPRESENT(PE4) \
| PIN_NOTPRESENT(PE5) \
| PIN_NOTPRESENT(PE6) \
| PIN_NOTPRESENT(PE7) \
| 0)
#define VAL_GPIOE_CRH ( 0 \
| PIN_NOTPRESENT(PE8) \
| PIN_NOTPRESENT(PE9) \
| PIN_NOTPRESENT(PE10) \
| PIN_NOTPRESENT(PE11) \
| PIN_NOTPRESENT(PE12) \
| PIN_NOTPRESENT(PE13) \
| PIN_NOTPRESENT(PE14) \
| PIN_NOTPRESENT(PE15) \
| 0)
#define VAL_GPIOE_ODR 0
#if !defined(_FROM_ASM_)
#ifdef __cplusplus
extern "C" {
#endif
void boardInit(void);
#ifdef __cplusplus
}
#endif
#endif /* _FROM_ASM_ */
#endif /* _BOARD_H_ */
//// My board.h- Giovanni
- Site Admin
- Posts: 14891
- Joined: Wed May 27, 2009 8:48 am
- Has thanked: 1202 times
- Been thanked: 996 times
Re: Problem with uart_lld.c
What ChibiOS version are you using? that board file is very old.
Giovanni
Giovanni