Multipilot32 branch and ChibiOS need developer ..

This forum is dedicated to feedback, discussions about ongoing or future developments, ideas and suggestions regarding the ChibiOS projects are welcome. This forum is NOT for support.
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Multipilot32 branch and ChibiOS need developer ..

Post by Giovanni »

The makefile of the various ChibiOS demos can already mix C and C++ files, you may just use that. Do you need an example C++ application with ChibiOS as template?

Anyway, please don't assume I am accepting tasks for your project, my personal bandwidth is limited, my job and this project already take most of it.

The best way to get help is to make specific and very focused questions regarding ChibiOS/RT in the context of your needs.

Giovanni
redfox74
Posts: 21
Joined: Sat Feb 12, 2011 12:08 am

Re: Multipilot32 branch and ChibiOS need developer ..

Post by redfox74 »

Don't worry Giovanni,
I need only a name of template that is yet available that i can use as starting point for my work .. , then we work on port wrapper , ecc , ecc , .. I think that you understand my idea ... :)

So in our implementation we need to use :

SerialPort,
Analog,
Digital IO,
SPI BUS,
I2C Bus. ( I know that is not yet officialy supported , but i need it, time for official support ? )
In future SD card.
DAC
and USB.

Best
Roberto
redfox74
Posts: 21
Joined: Sat Feb 12, 2011 12:08 am

Re: Multipilot32 branch and ChibiOS need developer ..

Post by redfox74 »

Hi Giovanni,
do you have news about the template ?
Best
Roberto
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Multipilot32 branch and ChibiOS need developer ..

Post by Giovanni »

I hope in the weekend.

Giovanni
Cyrille
Posts: 26
Joined: Sun May 15, 2011 7:55 pm

Re: Multipilot32 branch and ChibiOS need developer ..

Post by Cyrille »

Hi,

I'm looking for users who use chibios with the multipilot32 and oilpan. I'm interrested to exchange experiences, dev problems...

My project starts, and currently I'm able to acquire and to parse gps data via serial port, to acquire gyro and accelerometer via spi port.
Currently I try to work in unstable version in order to use i2c driver (to acquire pressure BMP085 and magnetic compass).
I have tried to run my code (dev with 2.2.0) with unstable version 3426, and it doesn't work despite a good build. May be I have made some mistakes in makefile, mcuconf.h. (there is no multipilot32 directory in boards directory so i use OLIMEX_STM32_P107)

Does anyone has a template project to use unstable version with multipilot32 ?

Does anyone have project which able to use in the same time the serial, spi and i2C with multipilot32 and oilpan boards.

Thanks

Cyrille
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Multipilot32 branch and ChibiOS need developer ..

Post by Giovanni »

OLIMEX_STM32_P107 uses a very different STM32, probably you should start from OLIMEX_STM32_P103 and then customize it:

- Change the MCU type to STM32F10X_HD.
- Change the board name to MULTIPILOT.
- Change the xtals frequencies.
- Customize I/Os.

The problem is that the setting in mcuconf.h are calculated for a 8MHz crystal, you have to change them in order to obtain the correct final frequency from the PLL.

I believe board files for the multipilot have been created by Roberto a while ago, probably you should ask him.
Cyrille
Posts: 26
Joined: Sun May 15, 2011 7:55 pm

Re: Multipilot32 branch and ChibiOS need developer ..

Post by Cyrille »

Hi giovanni,
I have tried also OLIMEX_STM32_P103, but this boad apparently used only 3 serial ports, and I use 4 ports (GPS is in port 4), I have tried in mcuconf to set to the TRUE USART 4, but no result.
I have also tried to include to the boards directory of unstable version the MULTIPILOT32 directory available in ver 2.2.0, but no result.

This is a problem with many variables (mcuconf, board, code...) and I have not enough experience in chibios and STM32 to identy where is the problem or what is my error.

Find below my project config files

makefile:

Code: Select all

# Define linker script file here
LDSCRIPT= $(PORTLD)/STM32F103xE.ld #ch.ld

# Imported source files
CHIBIOS = ../
include $(CHIBIOS)/boards/MULTIPILOT32/board.mk #OLIMEX_STM32_P107/board.mk #
include $(CHIBIOS)/os/hal/platforms/STM32F1xx/platform.mk
include $(CHIBIOS)/os/hal/hal.mk
include $(CHIBIOS)/os/ports/GCC/ARMCMx/STM32F1xx/port.mk
include $(CHIBIOS)/os/kernel/kernel.mk
# include $(CHIBIOS)/test/test.mk

# C sources that can be compiled in ARM or THUMB mode depending on the global
# setting.
CSRC = $(PORTSRC) \
       $(KERNSRC) \
       $(TESTSRC) \
       $(HALSRC) \
       $(PLATFORMSRC) \
       $(BOARDSRC) \
       $(CHIBIOS)/os/various/evtimer.c \
       $(CHIBIOS)/os/various/syscalls.c \
       test.c \
       Init.c \
       debug.c \
       GPS_parser.c \
       IMU.c \


mcuconf.h:

Code: Select all

/*
 * HAL driver system settings.
 */
#define STM32_SW                            STM32_SW_PLL
#define STM32_PLLSRC                        STM32_PLLSRC_HSE
#define STM32_PLLXTPRE                      STM32_PLLXTPRE_DIV1
#define STM32_PLLMUL_VALUE                  9
#define STM32_HPRE                          STM32_HPRE_DIV1
#define STM32_PPRE1                         STM32_PPRE1_DIV2
#define STM32_PPRE2                         STM32_PPRE2_DIV2
#define STM32_ADCPRE                        STM32_ADCPRE_DIV4
#define STM32_USBPRE                        STM32_USBPRE_DIV1P5
#define STM32_MCO                           STM32_MCO_NOCLOCK

/*
 * ADC driver system settings.
 */
#define STM32_ADC_USE_ADC1                  TRUE
#define STM32_ADC_ADC1_DMA_PRIORITY         2
#define STM32_ADC_ADC1_IRQ_PRIORITY         5

/*
 * CAN driver system settings.
 */
#define STM32_CAN_USE_CAN1                  TRUE
#define STM32_CAN_CAN1_IRQ_PRIORITY         11

/*
 * EXT driver system settings.
 */
#define STM32_EXT_EXTI0_IRQ_PRIORITY        6
#define STM32_EXT_EXTI1_IRQ_PRIORITY        6
#define STM32_EXT_EXTI2_IRQ_PRIORITY        6
#define STM32_EXT_EXTI3_IRQ_PRIORITY        6
#define STM32_EXT_EXTI4_IRQ_PRIORITY        6
#define STM32_EXT_EXTI5_9_IRQ_PRIORITY      6
#define STM32_EXT_EXTI10_15_IRQ_PRIORITY    6
#define STM32_EXT_EXTI16_IRQ_PRIORITY       6
#define STM32_EXT_EXTI17_IRQ_PRIORITY       6
#define STM32_EXT_EXTI18_IRQ_PRIORITY       6
#define STM32_EXT_EXTI19_IRQ_PRIORITY       6

/*
 * GPT driver system settings.
 */
#define STM32_GPT_USE_TIM1                  FALSE
#define STM32_GPT_USE_TIM2                  FALSE
#define STM32_GPT_USE_TIM3                  FALSE
#define STM32_GPT_USE_TIM4                  FALSE
#define STM32_GPT_USE_TIM5                  FALSE
#define STM32_GPT_USE_TIM8                  FALSE
#define STM32_GPT_TIM1_IRQ_PRIORITY         7
#define STM32_GPT_TIM2_IRQ_PRIORITY         7
#define STM32_GPT_TIM3_IRQ_PRIORITY         7
#define STM32_GPT_TIM4_IRQ_PRIORITY         7
#define STM32_GPT_TIM5_IRQ_PRIORITY         7
#define STM32_GPT_TIM8_IRQ_PRIORITY         7
/*
 * ICU driver system settings.
 */
#define STM32_ICU_USE_TIM1                  FALSE
#define STM32_ICU_USE_TIM2                  FALSE
#define STM32_ICU_USE_TIM3                  FALSE
#define STM32_ICU_USE_TIM4                  TRUE
#define STM32_ICU_USE_TIM5                  FALSE
#define STM32_ICU_USE_TIM8                  FALSE
#define STM32_ICU_TIM1_IRQ_PRIORITY         7
#define STM32_ICU_TIM2_IRQ_PRIORITY         7
#define STM32_ICU_TIM3_IRQ_PRIORITY         7
#define STM32_ICU_TIM4_IRQ_PRIORITY         7
#define STM32_ICU_TIM5_IRQ_PRIORITY         7
#define STM32_ICU_TIM8_IRQ_PRIORITY         7
/*
 * PWM driver system settings.
 */
#define STM32_PWM_USE_ADVANCED              TRUE
#define STM32_PWM_USE_TIM1                  TRUE
#define STM32_PWM_USE_TIM2                  FALSE
#define STM32_PWM_USE_TIM3                  FALSE
#define STM32_PWM_USE_TIM4                  FALSE
#define STM32_PWM_USE_TIM5                  FALSE
#define STM32_PWM_USE_TIM8                  FALSE
#define STM32_PWM_TIM1_IRQ_PRIORITY         7
#define STM32_PWM_TIM2_IRQ_PRIORITY         7
#define STM32_PWM_TIM3_IRQ_PRIORITY         7
#define STM32_PWM_TIM4_IRQ_PRIORITY         7
#define STM32_PWM_TIM5_IRQ_PRIORITY         7
#define STM32_PWM_TIM8_IRQ_PRIORITY         7
/*
 * SERIAL driver system settings.
 */
#define STM32_SERIAL_USE_USART1             TRUE
#define STM32_SERIAL_USE_USART2             TRUE
#define STM32_SERIAL_USE_USART3             TRUE
#define STM32_SERIAL_USE_UART4              TRUE
#define STM32_SERIAL_USE_UART5              FALSE
#define STM32_SERIAL_USART1_PRIORITY        12
#define STM32_SERIAL_USART2_PRIORITY        12
#define STM32_SERIAL_USART3_PRIORITY        12
#define STM32_SERIAL_UART4_PRIORITY         12
#define STM32_SERIAL_UART5_PRIORITY         12

/*
 * SPI driver system settings.
 */
#define STM32_SPI_USE_SPI1                  TRUE
#define STM32_SPI_USE_SPI2                  TRUE
#define STM32_SPI_USE_SPI3                  FALSE
#define STM32_SPI_SPI1_DMA_PRIORITY         1
#define STM32_SPI_SPI2_DMA_PRIORITY         1
#define STM32_SPI_SPI3_DMA_PRIORITY         1
#define STM32_SPI_SPI1_IRQ_PRIORITY         10
#define STM32_SPI_SPI2_IRQ_PRIORITY         10
#define STM32_SPI_SPI3_IRQ_PRIORITY         10
#define STM32_SPI_DMA_ERROR_HOOK(spip)      chSysHalt()

/*
 * UART driver system settings.
 */
#define STM32_UART_USE_USART1               FALSE
#define STM32_UART_USE_USART2               TRUE
#define STM32_UART_USE_USART3               FALSE
#define STM32_UART_USART1_IRQ_PRIORITY      12
#define STM32_UART_USART2_IRQ_PRIORITY      12
#define STM32_UART_USART3_IRQ_PRIORITY      12
#define STM32_UART_USART1_DMA_PRIORITY      0
#define STM32_UART_USART2_DMA_PRIORITY      0
#define STM32_UART_USART3_DMA_PRIORITY      0
#define STM32_UART_DMA_ERROR_HOOK(uartp)    chSysHalt()

/*
 * USB driver system settings.
 */
#define STM32_USB_USE_USB1                  TRUE
#define STM32_USB_LOW_POWER_ON_SUSPEND      FALSE
#define STM32_USB_USB1_HP_IRQ_PRIORITY      6
#define STM32_USB_USB1_LP_IRQ_PRIORITY      14


/*
 * I2C driver system settings.
 */
#define STM32_I2C_USE_I2C1                  TRUE
#define STM32_I2C_USE_I2C2                  TRUE
#define STM32_I2C_I2C1_IRQ_PRIORITY         10
#define STM32_I2C_I2C2_IRQ_PRIORITY         10
#define STM32_I2C_I2C1_DMA_PRIORITY         4
#define STM32_I2C_I2C2_DMA_PRIORITY         4
#define STM32_I2C_I2C1_DMA_ERROR_HOOK()     chSysHalt()
#define STM32_I2C_I2C2_DMA_ERROR_HOOK()     chSysHalt()
/* I2C1 */
#define STM32_I2C_I2C1_USE_GPT_TIM          GPTD1
#define STM32_I2C_I2C1_USE_POLLING_WAIT     TRUE
/* I2C2 */
#define STM32_I2C_I2C2_USE_GPT_TIM          GPTD2
#define STM32_I2C_I2C2_USE_POLLING_WAIT     TRUE


Multipilot32 board

Code: Select all

/*
 * Setup for the Olimex STM33-P103 proto board.
 */

/*
 * Board identifier.
 */
#define BOARD_MULTIPILOT32
#define BOARD_NAME              "Multipilot32"

/*
 * Board frequencies.
 */
#define STM32_LSECLK            0
#define STM32_HSECLK            8000000

/*
 * MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
 */
#define STM32F10X_HD

/*
 * IO pins assignments.
 */
#define GPIOA_BUTTON            0
#define GPIOA_SPI1NSS           4

#define GPIOB_SPI2NSS           12

#define GPIOC_USB_P             4
#define GPIOC_MMCWP             6
#define GPIOC_MMCCP             7
#define GPIOC_CAN_CNTL          10
#define GPIOC_USB_DISC          11
#define GPIOC_LED               12

/*
 * I/O ports initial setup, this configuration is established soon after reset
 * in the initialization code.
 *
 * The digits have the following meaning:
 *   0 - Analog input.
 *   1 - Push Pull output 10MHz.
 *   2 - Push Pull output 2MHz.
 *   3 - Push Pull output 50MHz.
 *   4 - Digital input.
 *   5 - Open Drain output 10MHz.
 *   6 - Open Drain output 2MHz.
 *   7 - Open Drain output 50MHz.
 *   8 - Digital input with PullUp or PullDown resistor depending on ODR.
 *   9 - Alternate Push Pull output 10MHz.
 *   A - Alternate Push Pull output 2MHz.
 *   B - Alternate Push Pull output 50MHz.
 *   C - Reserved.
 *   D - Alternate Open Drain output 10MHz.
 *   E - Alternate Open Drain output 2MHz.
 *   F - Alternate Open Drain output 50MHz.
 * Please refer to the STM32 Reference Manual for details.
 */

/*
 * Port A setup.
 * Everything input with pull-up except:
 * PA0  - Normal input      (BUTTON).
 * PA2  - Alternate output  (USART2 TX).
 * PA3  - Normal input      (USART2 RX).
 */
#define VAL_GPIOACRL            0x8888BBB0      /*  PA7...PA0 */
//#define VAL_GPIOACRH            0x888884B8      /* PA15...PA8 */ // Serial1 TX Serial1 RX
#define VAL_GPIOACRH            0x88888888      /* PA15...PA8 */ // Serial1 TX Serial1 RX DISATTIVATE

#define VAL_GPIOAODR            0xFFFFFFFF

/*
 * Port B setup.
 * Everything input with pull-up except:
 * PB13 - Alternate output  (MMC SPI2 SCK).
 * PB14 - Normal input      (MMC SPI2 MISO).
 * PB15 - Alternate output  (MMC SPI2 MOSI).
 */
#define VAL_GPIOBCRL            0x88888888      /*  PB7...PB0 */
#define VAL_GPIOBCRH            0xB4B88888      /* PB15...PB8 */
#define VAL_GPIOBODR            0xFFFFFFFF

/*
 * Port C setup.
 * Everything input with pull-up except:
 * PC4  - Normal input because there is an external resistor.
 * PC6  - Normal input because there is an external resistor.
 * PC7  - Normal input because there is an external resistor.
 * PC10 - Push Pull output (CAN CNTRL).
 * PC11 - Push Pull output (USB DISC).
 * PC12 - Push Pull output (LED).
 */
#define VAL_GPIOCCRL            0x44848888      /*  PC7...PC0 */
#define VAL_GPIOCCRH            0x88834B88      /* PC15...PC8 */ // SER 3 PC10 e PC11
#define VAL_GPIOCODR            0xFFFFFFFF

/*
 * Port D setup.
 * Everything input with pull-up except:
 * PD0  - Normal input (XTAL).
 * PD1  - Normal input (XTAL).
 */
#define VAL_GPIODCRL            0x84B88844      /*  PD7...PD0 */ // HO ATTIVATO SER 2 PD5-PD6
#define VAL_GPIODCRH            0x8888884B      /* PD15...PD8 */ // HO ATTIVATO SER 3 PD8-PD9
#define VAL_GPIODODR            0xFFFFFFFF

/*
 * Port E setup.
 * Everything input with pull-up except:
 */
#define VAL_GPIOECRL            0x88888888      /*  PE7...PE0 */
#define VAL_GPIOECRH            0x88888888      /* PE15...PE8 */
#define VAL_GPIOEODR            0xFFFFFFFF

#if !defined(_FROM_ASM_)
#ifdef __cplusplus
extern "C" {
#endif
  void boardInit(void);
#ifdef __cplusplus
}
#endif
#endif /* _FROM_ASM_ */

#endif /* _BOARD_H_ */


Do you have some remarks ?
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Multipilot32 branch and ChibiOS need developer ..

Post by Giovanni »

No remarks if the board has a 8MHz crystal.

You have to program correctly the UART pins in board.h as alternate or the UARTs will not output any data. I see commented lines there, probably that is not correct.

Your problem is that you have to create a correct board.h file, correct in all its parts, the other configuration files are less important.
Cyrille
Posts: 26
Joined: Sun May 15, 2011 7:55 pm

Re: Multipilot32 branch and ChibiOS need developer ..

Post by Cyrille »

Hi Giovanni,

I follow your advices, and I work on board.h for MULTIPILOT32. Concerning the GPIO configuration I have some difficulties to understand what is alternate function. I have understood that there is various function for each pin, and it is possible to attibuate specific function to pin (remap). what is the difference beween "Alternate push-pull output" and "push-pull output " for GPIO config (VAL_GPIOxCRL VAL_GPIOxCRH).

What is the correct configuration for :
- PWM
- SPI SCK, MISO MOSI (in master mode)
- UART Tx, Rx
- I2C

Thanks
Cyrille
User avatar
Giovanni
Site Admin
Posts: 14895
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 997 times

Re: Multipilot32 branch and ChibiOS need developer ..

Post by Giovanni »

Hi,

"push-pull output" is for for pins used as GPIOs while "Alternate push-pull output" is for pins used as the alternate functions, all the peripherals you mentioned are alternate functions.

Cyrille, I recommend to study the STM32 Reference Manual carefully (and the Datasheet for pin assignments), while the HAL abstracts a lot of things, working on an embedded application still requires strong knowledge of the hardware you are using. Remember, manuals are your best friends when it comes at understanding how it works and, more often, why it does not work :-)

Giovanni
Post Reply