Commit Graph

69 Commits (6ee4c7e21963b184b1f93c0bf9375b583dbc9051)

Author SHA1 Message Date
Sam Grove 8232afa53e Merge pull request #4216 from fmanno/issue-4189
STM32s Serial: Correct handling of parity bits
2017-06-06 20:00:19 -05:00
Sam Grove 72de85c62f Merge pull request #4417 from monkiineko/master
STM32: Fix 32-bit us ticker interrupt scheduling
2017-06-06 19:59:52 -05:00
Anna Bridge a41e08c7bf Merge pull request #4365 from LMESTM/fix_i2C_pcf_F1F2F4L1
Fix i2c communication with pcf8574 on stm32 targets of f1, f2, f4 and l1 families
2017-06-05 14:41:36 +01:00
Sam Grove 5f138810a9 Merge pull request #4294 from ARMmbed/feature_cmsis5
Update CMSIS-Core and RTX to version 5
2017-06-02 23:44:32 -05:00
Laurent MEUNIER a1f7a36461 STM32 HAL I2C fix RXNE case
As reported in issue #4214, there are seen issues seen first on
NUCLEO_F103RB in case of successive Reads of 1 byte at a time.

This issue is due to a wrong state management in the end of read sequence.
Also F1 i2c driver was not fully aligned to others, which is updated here.
2017-06-02 17:28:48 +02:00
Bradley Scott 260378e774 STM32: Fix 32-bit us ticker interrupt scheduling
For STM32 targets using a 32-bit timer for the microsecond ticker, the
driver did not properly handle timestamps that are in the past.  It
would just blindly set the compare register to the requested timestamp,
resulting in the interrupt being serviced up to 4295 seconds late
(i.e. after the 32-bit timer counts all the way around to hit the
timestamp again).

This problem can easily be reproduced by creating a Timeout object
then calling the timeout's attach_us() member function to attach a
callback with a timeout of 0 us.  The callback will not get called for
over 2147 seconds, and possibly up to 4295 seconds late if no other
microsecond ticker events are getting scheduled in the meantime.

Now, after the compare register has been set, the timestamp is checked
against the current time to see if the timestamp is in the past, and
if so, the compare event is manually set.

NOTE: By checking if the timestamp is in the past after configuring the
capture register, we ensure proper handling in the case where the timer
updates past the timestamp while setting the capture register.
2017-06-01 12:52:03 -04:00
Bartek Szatkowski f194ea7be9 Remove redefinitions of register macros from target code 2017-05-30 18:55:53 +01:00
Bartek Szatkowski b97ffe8fdc CMSIS5: Replace target defined NVIC_Set/GetVector with CMSIS implementation 2017-05-30 18:55:51 +01:00
Francisco J. Manno 5e98da14d3 STM32s Serial does not properly handle parity bits
Reworked the serial_format() function for STM32F0x
devices to take the format in the form:
data_bits - parity - stop_bits

E.g. 8 - N - 1

where data_bits exclude the parity bit.
Added a case for 7 bits data as at least the chips
STM32F0x1/STM32F0x2/STM32F0x8 support 7 bits data.

Consolidated serial_format() and uart_init()
functions into a general TARGET_STM serial_api.c
file since the functions are common to all STM targets.

Fixes #4189
2017-05-30 17:17:20 +01:00
Laurent MEUNIER 8576993a1a Introduce stm32_assert.h for MBED port
When we want to activate USE_FULL_ASSERT macro in STM32 CUBE, there is a
need to have the assert map to MBED.

The easiest way to have this definition in a single place for all STM32
HAL and LL files using it, is to add a specific header file where the
porting to MBED is done.
2017-05-29 13:48:29 +02:00
Shaun Nelson 30579e8131 4354 Fix MOTE_L152RC GPIO Write
Add #define GPI_IP_WITHOUT_BRR
2017-05-24 11:37:15 -04:00
Jimmy Brisson 0c2af26523 Merge pull request #4249 from kegilbert/button-mapping-kg
Add consistent button names across targets
2017-05-03 11:26:36 -05:00
Kevin Gilbert 28d1ac5a44 Added mapping to USER_BUTTON-labelled switches
Revert HRM1017 file source deletion

Added in small comment next to additions

Added mapping to BTN-labelled switches

Added mapping to USER_BUTTON-labelled switches

Undo incorrect mapping to SWIO pin in NORDIC target
2017-04-28 11:37:23 -05:00
Laurent MEUNIER 4eea8fa863 STM32 Fixed warning related to __packed redefinition
Before this patch, many warnings like below were generated
during compilation with ArmCC
[Warning] lwip_ethernet.h@57,0:  #3135-D: attribute does not apply to any entity

This happens here as ``--gnu`` option of ArmCC is being used, which
enables the GNU compiler extensions that the ARM compiler supports.

This is solve by adding a extra check on __CCARM .
2017-04-27 10:32:00 +02:00
Martin Kojtal fd6fdd5f8c Merge pull request #3795 from LMESTM/fix_pwm_period_calc
Fix pwm period calc
2017-03-09 15:39:00 +00:00
Laurent MEUNIER 400b89eeda Fix XDOT compilation error
Typo with misplaced closing parenthesis leads to compilation error,
which is fixed with this patch
2017-03-07 17:22:25 +01:00
Mike Fiore 2613380854 [XDOT_L151CC] Define GPIO_IP_WITHOUT_BRR for xDot platform. Resolves #3823. 2017-03-01 12:53:31 -06:00
Laurent MEUNIER 747e8e1ea1 STM32: move pwmout device tables to C file
In order to avoid possible multiple definitions errors, move the table
initialization to the C file instead of header file
2017-02-27 17:07:01 +01:00
Christopher Haster aff49d8d1e Renamed files in platform to match source names
critical.h     -> mbed_critical.h
sleep.h        -> mbed_sleep.h
toolchain.h    -> mbed_toolchain.h
rtc_time.h     -> mbed_rtc_time.h
semihost_api.h -> mbed_semihost_api.h
wait_api.h     -> mbed_wait_api.h
2017-02-22 18:17:54 -06:00
Laurent MEUNIER 1cbb3e18ac STM32: make PWM driver into a common file
The pwmout driver is very similar for each STM32 family.

The only family specific part is defined in pwmout_device.h file.
It mainly contains few specific information:
- The mapping of PWM/TIMERS to APB1 or APB2 so that we can get the clock
- The clock calculation uses the right APB clock, which was sometimes
not the case before and could have lead to errors in case dividers were
enabled on APB clock settings. This case is now covered.
- Inactivation of inverted support on feaw families
2017-02-17 14:11:56 +01:00
Laurent MEUNIER 293b9fc297 STM32 L1: Define PWM Channels in PeripheralsPins.c
As done for other families, let's define the PWM channel in the PWM
pins table definition rather than driver.
2017-02-17 14:11:41 +01:00
Laurent MEUNIER 32ecd00c3a STM32: move pin_lines_desc to c file
Move the const table initialization from the header file
to a new C file to avoid any multiple defined errors.
2017-02-16 19:34:11 +01:00
Laurent MEUNIER 73955b678e STM32: pins: move pin_lines_desc table to const 2017-02-16 19:34:05 +01:00
Laurent MEUNIER 273ac81680 stm32: use default in switch case
As commented during PR review, better use default case.
2017-02-16 19:34:01 +01:00
Laurent MEUNIER 21bc5af3c2 STM32: common pinmap using LL layer to access registers
this first makes pinmap.c a common file

then rework it with several goals:
- avoid gpio / irq / pin management extra dependencies
- improve performances when switching between pin modes

This change is based on LL layer to access to registers level
instead of using HAL higher level API.

The family specific functions are implemented in pin_device.h
of each family. Mostly this is F1 family that is differnt
from other ones.
2017-02-16 18:57:18 +01:00
Laurent MEUNIER 6bd488db4d STM32: gpio irq: Use LL registers access
Instead of using HAL_GPIO_Init / Deinit which makes a lot of registers
being written and re-written, and which creates extra gpio / pin / irq
dependencies, we directly set the IRQ related registers thanks for the
STM32 LL layers which provides APIs to modify registers.
2017-02-16 18:55:36 +01:00
Laurent MEUNIER 74774f9424 STM32 Make gpio_irq_api.c a common files
This requires the creation of gpio_irq_device.h file, where
family specific EXTI IRQ mapping is defined
2017-02-16 18:55:28 +01:00
Laurent MEUNIER 0e2cc3824b STM32 : Make port_api.c a common file 2017-02-16 18:55:20 +01:00
Martin Kojtal bdcda386d5 Merge pull request #3618 from LMESTM/dev_stm32_PinNamesTypes
STM32: Move types definitions to a common file
2017-01-26 10:35:59 +02:00
Laurent MEUNIER 42f6622f8e STM32: Move types definitions to a common file
Only one point of attention:
STM_MODE_ANALOG_ADC_CONTROL is a specific mode that is only supported on L4.
So STM_MODE_ANALOG_ADC_CONTROL was moved to index 13 (last entry)
of gpio_mode table so that all the other modes are common and only the last
one is specific.
2017-01-24 10:58:36 +01:00
Laurent MEUNIER 5d04b97b80 STM32: make PortNames.h a common file
the same file can be used for all targets
2017-01-19 15:27:19 +01:00
Martin Kojtal 3933ccf76e Merge pull request #3584 from LMESTM/dev_stm32_common_peripheralpins
STM32: make PeripheralPins.h a common file
2017-01-16 16:29:28 +00:00
Laurent MEUNIER 1a4394a4a2 STM32: make PeripheralPins.h a common file
Simple effort to avoid duplicate code.
2017-01-13 13:25:33 +01:00
Laurent MEUNIER 57e0225248 STM32: gpio: factorize gpio_api.c and gpio_object.h
Let's make the code more common for gpios.

The only difference between STM32 families is that BRR register may
not be available. In case BRR is not available, we use the 16 left bits
of BSRR instead. We could always use BSRR, but BRR saves one left-shift
operation, so let's use it when available.

By default we will consider using BRR, except for platforms that define
GPIO_IP_WITHOUT_BRR.
2017-01-12 19:24:32 +01:00
Laurent MEUNIER 7a36614e74 STM32: remove useless include
gpio_object.h is included from common_objects.h,
so no need to have it here.
2017-01-12 19:11:36 +01:00
jeromecoutant ab28a5e5cb STM32: Refactor lp_ticker.c + rtc_api.c + sleep.c + rtc_api_hal.h files 2016-12-21 16:54:18 +00:00
Martin Kojtal ce9d2526f8 Merge pull request #3409 from jeromecoutant/PR_ST_L1_ASSERT
STM32L1 : map ST HAL assert into MBED assert
2016-12-09 15:38:21 +01:00
Martin Kojtal b13954c6b5 Merge pull request #3377 from LMESTM/fix_L152RE_Rcc_Config
STM32 NUCLEO-L152RE Update system core clock to 32MHz
2016-12-09 15:36:07 +01:00
Martin Kojtal 04f940de2d Merge pull request #3324 from LMESTM/dev_i2c_common_code
Dev i2c common code
2016-12-09 15:30:00 +01:00
jeromecoutant 3ab5dce41d STM32L1 : correct ST HAL API call
- RCC init: unused clock was enabled without any init parameters
- RCC init: one PLL parameter was missing
- ADC: a parameter setting was missing to init clock
- GPIO: mode was not allowed by ST HAL API
- ll_utils: compilation issue
2016-12-09 11:32:08 +01:00
jeromecoutant 12d2795871 STM32L1 : refactor stm32l1xx_hal_conf.h and map ST HAL assert into MBED assert 2016-12-08 17:03:25 +01:00
Laurent MEUNIER 8e11541a74 STM32 NUCLEO-L152RE Update system core clock to 32MHz
Even when HSE is used, it is possible to get a 32MHz system clock
8MHz x PLLMUL=12 % PLLDIV=2 = 32MHz

And we still get 48MHz USB clock:
8MHz x PLLMUL=12 % 2 = 48MHz

This allows to take full benefit of the CPU capability.
2016-12-06 11:45:19 +01:00
Martin Kojtal 1c2c121741 Merge pull request #3303 from adustm/stm_fix_interrupt_in
Fix #2956 #2939 #2957 #2959 #2960: Add HAL_DeInit function in gpio_irq destructor
2016-12-02 15:47:50 +01:00
Laurent MEUNIER 3fad50287c [STM32] Make most of the I2C code into a common file
Since most of the code in i2c_api.c is now relying on STM32 HAL, there
is now a possibility to make a common usage of this code accross families.

The IP version definition is introduced per family, to allow a switch of
functionnalities, especially the frequency management which differs.
BTw, we fix the F0 frequency settings at the same time.

F1 is managed for now as an exception as the HAL API for sequential transmit
/receive is not yet available (coming soon)
2016-11-30 08:23:13 +01:00
Laurent MEUNIER 85a2f7ac49 [STM32] HAL L1: I2C fix btf / rxne cases
This is an alignement to F4 HAL as the same IP is used.
Next official HAL delivery update hall will include the same alignement.
2016-11-30 08:23:13 +01:00
Martin Kojtal a8ebfaa058 Merge pull request #3288 from LMESTM/dev_spi_asynch_l0l1
Dev spi asynch l0l1
2016-11-29 18:17:06 +01:00
adustm 0219b64af4 fix #2956. Add HAL_DeInit function if gpio_irq destructor
This allows ci-test-shield tests-api-interruptin to pass
2016-11-21 15:55:15 +01:00
Laurent MEUNIER 65db01f457 STM32L1 - update spi HAL driver
This is a temporary update waiting for the next official release
2016-11-18 09:59:53 +01:00
Laurent MEUNIER 7cdaba8474 [stm32] remove unused module member in spi_s struct 2016-11-18 09:59:53 +01:00
bcostm 896293d5be Replace TIM_MST_GET_PCLK_FREQ macro with TIM_MST_PCLK macro 2016-11-14 09:31:14 +01:00