Commit Graph

581 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
Sam Grove 3c3e35dd44 Merge pull request #4423 from arostm/nucleo_f412zg_remove_hal_conf
NUCLEO_F412ZG: Remove hal_conf file from NUCLEO_F412ZG
2017-06-06 19:59:31 -05:00
Sam Grove 4d7c045753 Merge pull request #4424 from LMESTM/STM32_16bits_tickers
Fix corner cases in STM32 16bit tickers
2017-06-06 19:59:08 -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
Laurent MEUNIER ea2cc1d0e1 STM32 16bits tickers: consider all corner cases in us_ticker_set_interrupt
The present commit comes from monkiineko mbed contributor.
The comments in code explains in details all the possible case and
how they are handled.
2017-06-05 13:12:20 +02:00
Laurent MEUNIER fbfbb5e982 STM32 16 bits ticker: fix grammar issues in comments 2017-06-05 13:12:20 +02:00
Laurent MEUNIER 572a096c08 STM32 16 bits tickers: save useless instance init
TimMasterHandle.Instance initialization can be removed from here,
because it will either have been already done previously,
or it will be done in the us_ticker_init() call immediately below.
2017-06-05 13:12:20 +02:00
Laurent MEUNIER 7bcabf7cc0 STM32 16 bits tickers: remove unused prototype
Since rework, this prototype is not needed anymore.
2017-06-05 13:12:20 +02:00
Laurent MEUNIER 27be2e1884 STM32 16 bits ticker: don't check FLAG just clear it
Not having the check will make the code more efficient.
2017-06-05 13:12:20 +02:00
Laurent MEUNIER 1b684ca4e9 STM32 16 bits tickers, no need to check TIM_FLAG_CC1OF FLAG
Following previous fixes on 16 tickers handling, the overflow flag
condition will not happen anymore, so the work-around in place is
not needed anymore
2017-06-05 13:12:20 +02:00
Laurent MEUNIER 35c68859c0 STM32: 16 bits ticker, fixes in set function and handler
This commit simplifies ticker interrupt set function and handler.

There were issues around the 16 bits timer wrap-around timing as we were
aligning interrupts with wrap-around limits (0xFFFF) and then reading
TIM_MST->CNT again in timer_update_irq_handler which could lead
to crossing case with the wrap-around (TIM_FLAG_UPDATE) case.

Now we're using the 16 lower bits of the timestamp as the reference from
using in set_compare and never changing it. There is also no need to set
comparator again in timer_update_irq_handler. This is more robust and
also more efficient.
2017-06-05 13:12:20 +02:00
Laurent MEUNIER b9b5f0b929 STM32 16bits ticker: rework us_ticker_read()
Move to a single more reliable implementation of us_ticker_read()
There were historically 2 versions of us_ticker_read() implementation.

The one removed here was not reliable because us_ticker_read() can be
called in interrupt context which means that TIM_MST->CNT would have
wrapped around while SlaveCounter is not yet updated. So there is a need
to check the TIM_FLAG_UPDATE inside this function, which was not done in
the implementation that is removed here.
2017-06-05 13:12:20 +02: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
Laurent MEUNIER 5af0c59588 STM32 F1: Only set GPIO pin speed in case of Output mode
There were still side effects, in particular on I2C master slave test,
when setting by default the Pin Speed for F1 family. So for F1 family,
let's do it only in case of Output which is the only case where this
actually applies on this family.
2017-06-02 17:24:01 +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
arostm ab87e7a65c NUCLEO_F412ZG: Remove hal_conf file
The board have to use th hal_conf file from F4/device directory
2017-06-01 16:52:22 +02:00
Martin Kojtal e229a49182 Merge pull request #4207 from geky/spi-remove-byte-locking
spi: Add SPI block-write to C++ and HAL for performance
2017-06-01 14:03:36 +02:00
Martin Kojtal 8a870a66c0 Merge pull request #4119 from hasnainvirk/cellular_feature_br
Cellular feature br
2017-06-01 14:01:17 +02:00
Jimmy Brisson 944a17fe3c Merge pull request #4402 from LMESTM/STM32_F2_CUBE_v160
Stm32 f2 cube sdk update to v1.6.0
2017-05-31 11:28:36 -05:00
Hasnain Virk 24de27c989 Major Refactoring & extensions
For keep supporting external APIs with the same name (supposedly there are a larger
number of users of those APIs), BufferedSerial and ATParser are being renamed.
BufferedSerial becomes UARTSerial, will complement a  future USBSerial etc.
ATParser becomes ATCmdParser.

* UARTSerial moves to /drivers

* APN_db.h is moved from platform to cellular/util/.

* Original CellularInterface is restored for backward compatability (again, supposedly there
  are users of that).

* A new file, CellularBase is added which will now servce as the base class for all
  upcoming drivers.

* Special restructuring for the driver has been undertaken. This makes a clear cut distinction
  between an on-board or an off-board implementation.
  	- PPPCellularInterface is a generic network interface that works with a generic FileHandle
          and PPP. A derived class is needed to pass that FileHandle.
        - PPPCellularInterface provides some base functionality like network registration, AT setup,
          PPP connection etc. Lower level job is delegated to the derived classes and various modem
          specific APIs are provided which are supposed to be overridden.
        - UARTCellularInterface is derived from PPPCellularInterface. It constructs a FileHandle and
          passes it back to PPPCellularInterface as well as provides modem hangupf functionality.
          In future we could proive a USBInterface that would derive from PPPCellularInterface and could
          pass the FileHandle back.
	- OnboardCellularInterface is derived from UARTCellularInterfae and provides hooks to
          the target provided implementation of onbard_modem_api.h. An off-board modem, i.e, a modem on
          a shield has to override the modem_init(), modem_power_up() etc as it cannot use
          onboard_modem_api.h.
2017-05-31 15:02:11 +03:00
Hasnain Virk ccbf00571f Introducing hal/modem_api.h
This provides a HAL layer for Modem bearing devices.
Provides a standard interface to upper layer drivers.
Platform providers will be implementing this API under their
specific targets.

As a reference, two implementations are provided under TARGET_C027 (UBLOX)
and TARGET_MTS_DRAGONFLY_F411RE (MultiTech).

targets.json now contains a tag "MODEM" which tells that this target
has a modem and the modem_api is protected by a flag DEVICE_MODEM
(following the DEVICE_SERIAL fashion ).
2017-05-31 15:02:11 +03:00
Hasnain Virk fcbcfafec5 Preparing grounds for modem api
* Lays down ground for mbed modem_api
* Standardizes pin names relating to modem device for UBLOX C027 and MTS_DRAGONFLY_F411RE
  devices
* Ublox modem api is changed to use a standard, platform independent name so that same
  api could be used with multiple ubloc modems.
* DCD Polarity macro is added to assist the driver in knowing correct polarity
2017-05-31 15:02:11 +03:00
Hasnain Virk 925f54bfce Heap size reduced to 64k for IAR
IAR heap sizes were hard configured to be 96k which is 75% of the
total RAM available. Reduced it to be 64k which is half of the available RAM.
2017-05-31 15:02:11 +03:00
Sam Grove e65bb8d1a2 spi: Added default spi_master_block_write implementation to stm targets
There is an easy default implementation of spi_master_block_write that
just calls spi_master_write in a loop, so the default implementation
of spi_master_block_write has been added to all targets.
2017-05-30 23:11:24 -05:00
Bartek Szatkowski 85cc9c8381 Remove deprecated RTX4 config options 2017-05-30 18:55:55 +01:00
andreas.larsson abcae6f01e Updated driver binaries for feature_cmsis5 as v2.0 rc1 2017-05-30 18:55:55 +01:00
Bartek Szatkowski f194ea7be9 Remove redefinitions of register macros from target code 2017-05-30 18:55:53 +01:00
Bartek Szatkowski b793a3fb89 Update codebase for CMSIS5/RTX5
Update all of mbed-os to use RTX5.
2017-05-30 18:55:52 +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
Anna Bridge 45b4d41bbd Merge pull request #4329 from adustm/can_sync_error
Fix for #3863: STM Check can sync error
2017-05-30 16:52:09 +01:00
Anna Bridge 9c6a068d48 Merge pull request #4324 from monkiineko/master
STM32F3: Remove dependence upon a specific flash vector table location
2017-05-30 16:50:45 +01:00
Laurent MEUNIER eeb9672387 STM32: Check TIM_AUTORELOAD_PRELOAD_DISABLE
F2 family also require that TIM_AUTORELOAD_PRELOAD_DISABLE is set,
otherwise the field could have undefined value from the stacj and may
lead to undefined behavior.

The error was found using USE_FULL_ASSERT HAL option.

Rather than adding F2 to the list of family, let's set this parameter for
any family where TIM_AUTORELOAD_PRELOAD_DISABLE applies.
2017-05-29 13:48:29 +02: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
Laurent MEUNIER 5b510a35a6 F2 CUBE V1.6.0
This PR updates STM32 Cube SDK to
- HAL V1.2.1
- LL V1.2.1
- CMSIS 2.2.0
2017-05-29 13:48:29 +02:00
adustm 6770678811 Fix another typo 2017-05-29 10:24:03 +02:00
adustm 795bfd2288 Fix coding style 2017-05-29 10:24:03 +02:00
adustm b99ccf65bd Add timeout also on the 1st while loop 2017-05-29 10:24:03 +02:00
adustm 9a1d05551b Optimize the use of the status value 2017-05-29 10:24:03 +02:00
adustm 897625cc96 Give access to HAL_GetTick function 2017-05-29 10:24:03 +02:00
adustm 52d38a1be0 Handle can_frequency sync error
add a timeout + return an error message
2017-05-29 10:24:03 +02:00
Sam Grove 2561e0bff4 Merge pull request #4299 from jeromecoutant/PULL_REQUEST_CUBE_UPDATE_F4_V1.16.0
STM32F4 cube update from v1.12.0 to v1.16.0
2017-05-26 17:13:08 -05:00
Sam Grove 2500ab03f2 Merge pull request #4351 from jeromecoutant/PULL_REQUEST_CUBE_UPDATE_L4_V1.8.0
STM32L4 cube update from v1.5.0 to v1.8.0
2017-05-26 16:58:37 -05:00
Sam Grove c74013e932 Merge pull request #4383 from snelson-senet/master
#4354 Fix MOTE_L152RC GPIO Write
2017-05-26 16:27:25 -05:00
Sam Grove d11289b576 Merge pull request #4165 from adustm/can_init
fix #3863 Add an mbed API that allows the init of the CAN at the bus frequency
2017-05-26 10:45:19 -05:00
Shaun Nelson 30579e8131 4354 Fix MOTE_L152RC GPIO Write
Add #define GPI_IP_WITHOUT_BRR
2017-05-24 11:37:15 -04:00
jeromecoutant 5dc49b7d6c STM32L4 replace deprecated macro name 2017-05-19 11:59:38 +02:00
Martin Kojtal 5d0ce3c531 Merge pull request #4338 from andreaslarssonublox/ublox_odin_driver_os_5_v1.3_rc2
u-blox ODIN driver v1.3 rc2 for mbed OS 5
2017-05-19 08:42:14 +01:00