Commit Graph

1623 Commits

Author SHA1 Message Date
Nico Tonnhofer 230572b1d0 STM32F411: simplify cmsis files for stm32f411
Delete some macros from cmsis-file we will never use again.
Also replace magic numbers.
Add missing flag to allow -O0 (using R7 as register)
2017-03-05 15:00:12 +01:00
Nico Tonnhofer dea9cec217 STM32F411: uff... ADC works. Really? Really!
Was a little bit tricky. When using ADC with DMA and infitiy readings, everthing is ok. But we don't need so much readings.
To read only one shot after starting the ADC, we need something more.
Disabling continuous conversion and unset the DMA bit. So conversion is stopped. Else the next conversion could start at any ADC.
For a restart just enable again the DMA bit, the continuous conversion and start the ADC.
2017-03-03 18:54:57 +01:00
Nico Tonnhofer 767c4a6911 STM32F411: simplify analog readings
We don't need an interrupt for the DMA.
Simply clear and set the DMA-bit for the ADC is sufficient.
2017-03-03 18:54:57 +01:00
Nico Tonnhofer aeb98b557b STM32F411: cleanup code with using pinio.h macros. 2017-03-03 18:54:57 +01:00
Nico Tonnhofer 56c2238fef dda.c/dda_maths: add int_f_sqrt for controller with FPU
very fast sqrt in hardware
also accurate dda->c for high steps/mm without overflowing
2017-03-03 18:54:57 +01:00
Nico Tonnhofer 7fcb8fd20c pinio.h: rename _PULLUP_OFF also on STM32 to _PULL_OFF
added also some information about possible modes
removed deprecated comment
2017-03-03 18:54:57 +01:00
Nico Tonnhofer 0cfc503c4a STM32F411: easy change system clocks
- 96MHz
- 100MHz
- 108MHz

100MHz is standard now. 108MHz was possible on a first test, but is not recommended for real systems!
2017-03-03 18:54:57 +01:00
Nico Tonnhofer dc9e016e2c STM32F411: implement SPI
add some helpers in pinio.h also
2017-03-03 18:54:57 +01:00
Nico Tonnhofer 7223c9dea8 ARM: split out spi-avr.c from spi.c 2017-03-03 18:54:57 +01:00
Nico Tonnhofer d9a350749d STM32F411: save cpu cycles are 160
Also, first interrupt should not occur at 0.
2017-03-03 18:54:57 +01:00
Nico Tonnhofer ab03852750 STM32F411: add cpu-stm32.c 2017-03-03 18:54:57 +01:00
Nico Tonnhofer a4083dc360 ARM: rename cpu-arm.c to cpu-lpc.c 2017-03-03 18:54:57 +01:00
Nico Tonnhofer dee35e2c02 STM32F411: enable temperature control. 2017-03-03 18:54:57 +01:00
Nico Tonnhofer 6f334be231 STM32F411: support inverted heater pin signals. 2017-03-03 18:54:57 +01:00
Nico Tonnhofer afc4c3e8e4 STM32F411: Allow non-PWM pins as heater output. 2017-03-03 18:54:57 +01:00
Nico Tonnhofer 423c5694d0 STM32F411: Respect configured PWM frequencies in heater-stm32.c
Test: the PWM frequency on the scope should be similar to the
one configures in the board file with DEFINE_HEATER().
2017-03-03 18:54:57 +01:00
Nico Tonnhofer 06c6aed23d STM32F411: Turn on only timers needed in heater-stm32.c
Test: PWM pins work as before.
2017-03-03 18:54:57 +01:00
Nico Tonnhofer 12691b4488 STM32F411: Implement heater_set() in heater-stm32.c.
Works very nicely from full off (M106 S0) to full on (M106 S255).

Test: M106 should work now as expected. M106 S0 should turn full
off, M106 S255 should turn full on, both without any spike on the
scope.
2017-03-03 18:54:57 +01:00
Nico Tonnhofer df78b8d826 STM32F411: implement heater-stm32.c partially.
Like Traumflugs implementation at a fixed frequency of 1kHz and a fixed duty
cycle of 10%.
2017-03-03 18:54:57 +01:00
Nico Tonnhofer 8347b09c0f ARM: rename heater-arm.c to heater-lpc.c 2017-03-03 18:54:57 +01:00
Nico Tonnhofer 75af589f43 STM32F411: comment out analog_mask and adc_channel for STM32 2017-03-03 18:54:57 +01:00
Nico Tonnhofer efd8279c1a STM32F411: implement DMA for ADC
Eureka!!!
The STM32 has only one data register for all channels. So I want to use the ADC over DMA.
Issues are: It is not possible to stop the DMA or the ADC without uninit and init the hole parts.
We have more or less one option. Manually start the ADC.
So what we have now. We start the ADC after reading the values from DMA buffer. The ADC now make a conversion of all channels.
We can read also the values because it uses a double buffer mode. With that mode we can read the unused buffer.
2017-03-03 18:54:57 +01:00
Nico Tonnhofer 4cb6f85e3c STM32F411: implement analog-stm32.c
It's not that easy like LPC. We need later an DMA to control all ADCs, because there is only one register to read the ADC.
2017-03-03 18:54:57 +01:00
Nico Tonnhofer c3a8b7fd06 ARM: rename analog-arm.c to add more ARMs 2017-03-03 18:54:57 +01:00
Nico Tonnhofer 14a4980ea1 STM32F411: implement the stepper interrupt. 2017-03-03 18:54:56 +01:00
Nico Tonnhofer 42b26d9c20 STM32F411: get clock.c in.
No code changes neccessary.

This code in ifclock(clock_flag_1s) in clock.c should give a nice,
accurate clock:

    static uint8_t minutes = 0, seconds = 0;

    seconds++;
    if ( ! (seconds % 60)) {
      seconds = 0;
      minutes++;
    }
    sersendf_P(PSTR("%su:"), minutes);
    if (seconds < 10)
      serial_writechar('0');
    sersendf_P(PSTR("%su\n"), seconds);

Current sizes are:

    SIZES          ARM...     stm32f411
    FLASH  :  4464 bytes           1%
    RAM    :   204 bytes           1%
    EEPROM :     0 bytes           0%
2017-03-03 18:54:56 +01:00
Nico Tonnhofer a798cfac34 STM32F411: get timer.c in, so far only with the system clock.
This test code in SysTickHandler() should give you a rather
accurate clock with only a few seconds deviation per hour:

  #include "serial.h"
  #include "sersendf.h"
  void SysTick_Handler(void) {
    static uint32_t count = 0;
    static uint8_t minutes = 0, seconds = 0;

    count++;

    if ( ! (count % 500)) {   // A full second.
      seconds++;
      if ( ! (seconds % 60)) {
        seconds = 0;
        minutes++;
      }
      sersendf_P(PSTR("%su:"), minutes);
      if (seconds < 10)
        serial_writechar('0');
      sersendf_P(PSTR("%su\n"), seconds);
    }
  [...]
2017-03-03 18:54:56 +01:00
Nico Tonnhofer 65dab6b180 STM32F411: create timer-stm32.c
Empty, so far.
2017-03-03 18:54:56 +01:00
Nico Tonnhofer a1ba27f211 ARM: rename timer-arm.c to timer-lpc.c 2017-03-03 18:54:56 +01:00
Nico Tonnhofer c83ada5e07 STM32F411: introduce sei() and cli() also for STM32F411 2017-03-03 18:54:56 +01:00
Nico Tonnhofer 2da993220e STM32F411: add CNC Shield V3 for Nucleo to the series of regression tests.
Now Nucleo F411RE based boards are covered as well :-)
2017-03-03 18:54:56 +01:00
Nico Tonnhofer 3e76406b8c STM32F411: add CNC Shield V3 for Nucleo Pinout 2017-03-03 18:54:56 +01:00
Nico Tonnhofer 01be683b6c STM32F411: Enable all GPIO-clocks in SystemInit()
Serial pins are also there.
2017-03-03 18:54:56 +01:00
Nico Tonnhofer fd81ea9c60 STM32F411: prettify cmsis-system_stm32f4xx.c/.h.
Remove trailing whitespace and such stuff.
2017-03-03 18:54:56 +01:00
Nico Tonnhofer 8cf27adcba ARM: rename mbed-system_stm32f4xx.c/.h to cmsis-system_stm32f4xx.c/.h.
Last part of the effort to rename all CMSIS-provided files to "cmsis-".
2017-03-03 18:54:56 +01:00
Nico Tonnhofer be4c4eb90b STM32F411: prettify cmsis-core / cmsis-stm
This is just wording for the Teacup changes notes consistent with
    the other cmsis- files.
2017-03-03 18:54:56 +01:00
Nico Tonnhofer 487e6ff6ec STM32F411: rename mbed-core_cm4.h and mbed-core_cm4_simd.h
to cmsis-core_cm0.h and cmsis-core_cm4_simd.h

    Part of the effort to rename all CMSIS-provided files to "cmsis-".
2017-03-03 18:54:56 +01:00
Nico Tonnhofer 7dd657d56a STM32F411: rename mbed-stm32f4xx.h to cmsis-stm32f4xx.h.
Part of the effort to rename all CMSIS-provided files to "cmsis-".
2017-03-03 18:54:56 +01:00
Nico Tonnhofer e8e689b25c STM32F411: rename arm-startup_stm32f411xe.s to cmsis-startup_stm32f411xe.s. 2017-03-03 18:54:56 +01:00
Nico Tonnhofer 1954780892 STM32F411: rename arm-stm32f411xe.ld to cmsis-stm32f411xe.ld
This is the start of renaming all CMSIS related files to
"cmsis-...".
2017-03-03 18:54:56 +01:00
Nico Tonnhofer b9107397b2 STM32F411: serial-stm32.c: allow sending arbitrarily long messages.
On ARM we use only the 16 byte hardware buffer for sending and
receiving over the serial line, which is often too short for
debugging messages. This implementation works fine and still
neither blocks nor introduces delays for short messages.

Removed while-loop. Looks like we need some more us than the LPC?!? With +7us
we do not lose characters anymore.
2017-03-03 18:54:56 +01:00
Nico Tonnhofer 2a96564228 STM32F411: get delay-stm32.c in 2017-03-03 18:54:56 +01:00
Nico Tonnhofer c0cd80bbc3 ARM: rename delay-arm.c to delay-lpc.c 2017-03-03 18:54:56 +01:00
Nico Tonnhofer 534229c0fb STM32F411: get rid of RCC
..and finally one of the last mbed-files are gone.
remove mbed-stm32f4xx_hal_
- conf.h
- def.h
- rcc.c
- rcc.h
    SIZES          ARM...     stm32f411
    FLASH  :  1356 bytes           1%
    RAM    :   136 bytes           1%
    EEPROM :     0 bytes           0%
2017-03-03 18:54:56 +01:00
Nico Tonnhofer 3da6cc9a2c STM32F411: remove tick, trick and tim
remove mbed-hal_tick_stm32.h/.c
and mbed-stm32f4xx_hal_tim..h/.c

Also mbed-cmsis_nvic_stm32.h/.c and mbed-cmsis_stm32.h isn't needed anymore

    SIZES          ARM...     stm32f411
    FLASH  :  2224 bytes           1%
    RAM    :   136 bytes           1%
    EEPROM :     0 bytes           0%
2017-03-03 18:54:56 +01:00
Nico Tonnhofer d699644ea6 STM32F411: remove mbed-stm32f4xx_hal.c/.h
removed also HAL_IncTick()/HAL_GetTick()
    SIZES          ARM...     stm32f411
    FLASH  :  2252 bytes           1%
    RAM    :   136 bytes           1%
    EEPROM :     0 bytes           0%
2017-03-03 18:54:55 +01:00
Nico Tonnhofer eb8c5a39e1 STM32F411: cleaning mbed
delete mbed-stm32f4xx_hal_
- dma.h
- flash.h
- legacy.h
- pwr.h
- uart.h

    SIZES          ARM...     stm32f411
    FLASH  :  3108 bytes           1%
    RAM    :   208 bytes           1%
    EEPROM :     0 bytes           0%
2017-03-03 18:54:55 +01:00
Nico Tonnhofer 3af3919303 STM32F411: clean mbed-stm32f4xx_*.h from *_ex.h
Everything in one shot is too much. Really easy to delete those _ex.h-files.
    SIZES          ARM...     stm32f411
    FLASH  :  3132 bytes           1%
    RAM    :   212 bytes           1%
    EEPROM :     0 bytes           0%
2017-03-03 18:54:55 +01:00
Nico Tonnhofer a890fecc6d STM32F411: use arduino.h for UART pinout.
delete 11 mbed-files
    SIZES          ARM...     stm32f411
    FLASH  :  3124 bytes           1%
    RAM    :   212 bytes           1%
    EEPROM :     0 bytes           0%
2017-03-03 18:54:55 +01:00
Nico Tonnhofer 73df1be2d2 STM32F411: implement PULLUP_ON() and PULLUP_OFF(). 2017-03-03 18:54:55 +01:00