Page 1 of 1

STM32 Configuration

Posted: Mon Apr 13, 2015 9:49 am
by Slaxx
I try to port the whole Crazyflie Setup to NuttX (http://www.nuttx.org). To make the NuttX run I need to configure the Pins properly. I came up with the idea of using STM32CubeMX since it should be easier than pure Coding. However I'm not sure what to use for some of the Pins.

Pin 2,3 are used for the MPU. Is this just general Input/Output?
Pin 5,6 I configured as RCC but I'm not sure what tho set in HSE and LSE. {Disable, Crystal/Ceramic Resonator, BYPASS Clock Source}
Pin 20 Is this also just a General Input/Output?
Pin 34,36 are SPI2 but I have no idea what to set in Mode {Full-Duplex, Half-Duplex, Receive Only, Transmit Only}/{Master,Slave}

The 2nd Problem is the Clock Configuration. There are a lot of Options and I'm not sure what to set.
Image

Thx for any help. Maybe you even also used the CubeMX and have some configuration files :)

Re: STM32 Configuration

Posted: Tue Apr 14, 2015 8:01 am
by arnaud
That is a nice project. I was actually curious about Nuttx.

There is some useful comments on the schematic on how things are configured: https://wiki.bitcraze.io/_media/project ... matics.pdf

Pin 2,3: MPU_FSYNC should be something like pull-up/pulldown and MPU_INT is an input, it is the interrupt signal.
Pin 5,6: HSE Crystal
Pin 20: This is a tricky one: it is the flow control for the NRF51 uart, it is an input. The trick is that the UART used for nRF51 communication does not have hardware flow control so this is done in software. We are implementing this flow control with GPIO interrupts and DMA. It is easier to implement if when controlling the UART with interrupt only.
Pin 34, 36: This is SWD for the nrf51, you do not need to care about that right away. It is cable so that the STM32 can program the NRF51. I do not know exactly the config I think it was half duplex spi master. I suggest you keep these pin unused for now.

This clock config look good. As a rule of thumb we set everything max speed by default so on this screenshoot the only thing I could change is APB1 and APB2 prescaller. Of course we do not have to put everything full speed and we might want to do some power management in the future but in the mean time I thing we set everything max.

We looked at CubeMX but they did not have stm32f1 back then so we did not switch but we might in the future ;).

Good luck,
Arnaud