Commit Graph

50 Commits (e2048b06b2c4aeddc36be4353855f523a43427d6)

Author SHA1 Message Date
Martin Kojtal 7177d8fefe
Merge pull request #11950 from ABOSTM/DISCO_H747I_TICKLESS
DISCO_H747I: add support of MBED_TICKLESS
2019-11-29 09:48:09 +01:00
Przemyslaw Stekiel b2dad08387 Change explicit pinmap to static pinmap 2019-11-28 08:32:12 +01:00
Przemyslaw Stekiel ba12228556 Explicit pinmap: Fix build failures reported by CI 2019-11-28 08:32:03 +01:00
Przemyslaw Stekiel 2185e80e08 STM32F4 I2C driver: Add explicit pinmap support 2019-11-28 08:31:59 +01:00
Alexandre Bourdiol affe7113ef TARGET_STM: Remove timeout on HSEM.
With tickless mechanism hsem can be used for quite a long time
(time to set up PLL clock).
Also, if hsem is held to long, then this is not the current core which is faulty,
but probably the other (the one which hold the HSEM)
2019-11-27 14:25:43 +01:00
Martin Kojtal 9db54bc1ee
Merge pull request #11672 from ABOSTM/I2C_FASTMODEPLUS
STM32F767ZI - I2C FastModePlus not properly enabled
2019-10-22 09:46:16 +02:00
Alexandre Bourdiol 728a1c4383 STM32F767ZI - I2C FastModePlus not properly enabled 2/2
Warning: sometimes I2C_FASTMODEPLUS_I2Cx is defined,
even if not supported by some chip within the family
2019-10-15 13:46:29 +02:00
Alexandre Bourdiol adcf0e2fa5 DISCO_H747I Dualcore support
Add 2 targets for DISCO_H747I dualcore:
* DISCO_H747I      -> for CM7 core
* DISCO_H747I_CM4  -> for CM4 core

Current restrictions:
* TICKLESS deactivated
* DeepSleep not supported (DeepSleep wrapped to sleep)

Warning: use of the same IP (example I2C1) by both core at the same time is not prevented,
but is strongly not recommended.
Some Hardware Semaphore are use for common IP, to manage concurrent access by both cores: Flash, GPIO, RCC.

Warning: Drag and drop of binary to DISCO_H747I will flash CM7.
         In order to flash CM4, one can use STM32 CubeProgrammer tool.
2019-10-14 18:02:57 +02:00
Alexandre Bourdiol 66765332e0 STM32F767ZI - I2C FastModePlus not properly enabled
Fixes #11659
2019-10-10 10:26:59 +02:00
Alexandre Bourdiol de121a308a Fix I2C issue with test mbed_hal_fpga_ci_test_shield
On last case #5 there was a last unexpected read.
It happened when stop condition was generated
2019-08-26 14:01:23 +02:00
Alexandre Bourdiol 7910de2f38 TARGET_STM: Fix I2C sequential communication
Keep former behaviour for I2C V1.
For I2C V2:
Use only I2C_FIRST_FRAME, I2C_FIRST_AND_LAST_FRAME and I2C_LAST_FRAME,
thus we avoid using reload bit.
Reload suppose the next frame would be in the same direction,
but we have no guarranty about this. So we cannot use reload bit.
Note: in case of 2 consecutive I2C_FIRST_FRAME,
a restart is automatically generated only if there is direction change in the direction.
2019-08-23 16:26:19 +02:00
jeromecoutant 5d80f9e98f STM32: remove compilation warning 2019-06-07 18:08:39 +02:00
Michael Coulter c59c1cb29d Fix for i2c_t object not being initialized to 0 causing timeout
For issue #9890
2019-03-05 11:35:18 -06:00
Russ Butler 22a89773fa Add HAL API for i2c pinmap
Add the functions i2c_master_sda_pinmap, i2c_master_scl_pinmap,
i2c_slave_sda_pinmap and i2c_slave_scl_pinmap to all targets.
2019-02-08 09:10:12 -06:00
jeromecoutant b1a284a876 STM32: astyle check 2019-01-10 10:22:21 +01:00
bcostm 9cade872db STM32: Fix I2C stop condition
Need to ensure the transmission has been started before sending a STOP condition.

Issue found on the NUCLEO_H743ZI due certainly to the high-speed clock used.

But this is normally needed also on all STM32 devices using the I2C peripheral version 2.
2018-09-28 14:49:17 +02:00
jeromecoutant 433ba46132 TARGET_STM astyle 2018-06-27 14:21:07 +02:00
jeromecoutant 9f4bec2f2e STM32F0 : ST CUBE version update to V1.9.0
- Previous ST Cube version: V1.7.0
- CMSIS part update from 2.3.1 to 2.3.3
- HAL part update from 1.5.0 to 1.7.0
2018-01-05 14:46:33 +01:00
bcostm 35bf526ca4 STM32: Remove IAR compilation warning 2017-10-18 10:07:06 +02:00
Laurent MEUNIER 076b096efe STM: I2C: Confifure pins in OpenDrainNoPull by default (no pullup)
As reported by MBED user Fran6Jack:
I2C bus are usually 5V tolerant on all STM32 processor.
If an external device on the I2C bus requires 5V operation,
we usually acheive it by using 5V external pull-ups on the bus.
Since signaling uses open-drain output on I2C for both signal SCL and SDA
any 5V tolerant MCU will work on a 5V I2C bus. Having pull-up activated on a 5V externally pull bus, cause the pin to clamp on the STM32 die diode and could damage the IC (There is a note in STM32 datasheet specifying this issue).
It is understood by all the community that I2C bus should always be
externally pulled by physical resistor. I2C initialization should then
be ALWAYS OpenDrainNoPull by default.

Up to now, this I2C driver was setting pull up by default as it helps
basic testing, like 1 master and 1 slave, conencted with 2 wires without
any external pull ups. This will not work anymore after this commit and
applications tests or examples needs to be modified to explicitely
configure pull ups ...  But it is safer to follow reference manual
guidelines.
2017-09-14 17:15:11 +02:00
Bradley Scott 251459e8aa STM32: Remove i2c_read() and i2c_write() redirects to HAL_I2C_IsDeviceReady()
Some I2C devices require specific zero length read/write sequences which
the HAL_I2C_IsDeviceReady() redirect interferes with.  After Removing
these redirects, it was confirmed that zero length reads and writes
would both still work correctly for detecting presence/absence of an
I2C device on a bus.
2017-07-05 14:02:34 -04:00
Laurent MEUNIER 675d78d180 STM32 remove usage of deprecated MACROs 2017-05-09 16:48:34 +02:00
Bradley Scott 2eb4048bbe STM32: Correct I2C master error handling
If I2C slave support is included, then the I2C error handler would
always reset the I2C address, resulting in incorrectly changing the
I2C state to listen for a controller configured as I2C master.  This
change conditionalizes the address setting to only occur if the
controller was in slave mode when the error occurred.
2017-03-24 10:16:34 -04: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
Sam Grove b7dce71510 Merge pull request #3665 from LMESTM/dev_stm32_gpio_pins_rework
Dev stm32 gpio pins rework
2017-02-21 10:41:16 -06:00
Laurent MEUNIER 5317ea5bb6 STM32: I2C - pin mode
The default pin mode shall be set as part of the pinamp_pinout, and
as defined in tables of PeripheralPins.c, but this is currently
over-written by a call to pin_mode(pin, PullNone); from
mbed_pinmap_common.c, so we need a set the mode again here, including
OpenDrain config as needed for I2C.
2017-02-16 18:57:34 +01:00
Sam Grove 0e04161356 Merge pull request #3685 from LMESTM/fix_i2c_sw_reset
STM32: I2C: reset state machine
2017-02-07 10:38:53 -06:00
Laurent MEUNIER 57f4df64e5 STM32: I2C: reset state machine
this I2C IP is meant for automatic STOP, based on programmed number
of bytes to be sent or receivede, not a user triggered STOP.
So the state machiine needs to be reset in case we use this I2C mbed
unitary API (start / byte_write / byte_read / stop).
2017-02-03 13:41:52 +01:00
Sam Grove b9449dad7c Merge pull request #3628 from LMESTM/fix_warnings
Fix warnings
2017-02-02 10:50:58 -06:00
bcostm c1f712872d Fix bug in i2c_byte_read function 2017-01-24 16:50:55 +01:00
Laurent MEUNIER 1b94e234e3 STM32: I2C: remove warning
Remove unused variables to avoid warnings.
2017-01-23 17:07:52 +01:00
Anna Bridge 74f192add5 Merge pull request #3567 from LMESTM/dev_stm32_hal_F0_V1.7.0
Dev stm32 F0 v1.7.0
2017-01-13 10:52:49 +00:00
Laurent MEUNIER 0ca04ffb3e STM32: HAL update, use I2C function instead of MACRO
Following HAL update, this is needed to use the I2C API function
rather than previously used MACRO.

An assert would fail at compilation time otherwise.
2017-01-10 16:53:15 +01:00
Laurent MEUNIER 4297e3fd36 STM32: I2C: i2c_byte_read return value in case of error
To make clear that an error is being reported, we shall report -1,
2 being the timeout error for i2c_byte_write only.
2017-01-03 18:06:19 +01:00
Laurent MEUNIER 455c2ecbea STM32: I2C: remove debug code
Few debug lines were to be removed / updated.
Move the printf to DEBUG_PRINTF and return the error when needed.
2017-01-03 10:18:56 +01:00
Laurent MEUNIER 20c9af8bec STM32: I2C unitary functions for IP V2
STM32 supported targets have 2 possible versions of I2C.
This patch makes the start / stop / read and write byte work ok for IP V2.
This was not working before and does not seem to be widely used.
2016-12-21 09:27:52 +01:00
Anna Bridge f2ce7ebb99 Merge pull request #3442 from LMESTM/dev_stm_i2c_f1
Dev stm i2c f1
2016-12-19 17:51:58 +00:00
Laurent MEUNIER 580d96431e STM32 I2C manage STOP specific case
In case the user applicaiton makes a mixed usage of unitary function
(start, stop, byte write & read) with SYNC operation (write and read of
data buffers with start and stop management), we need to reset the
STM32 HAL state as it is by-passed by a direct call to STOP
2016-12-16 08:54:39 +01:00
Laurent MEUNIER 8406a99dc8 STM32 I2C: avoid timeout to be 0
In continuation of previous IsDeviceReady case, let's
add 1 in case length is 0 (even though not recommended)
2016-12-16 08:54:39 +01:00
Laurent MEUNIER 37c94a03f0 STM I2C: manage Is Device Ready case
Some device drivers use a data lenght of 0 to check if device is ready.
STM32 HAL provides a dedicated service for that, so let's use it.
2016-12-16 08:54:39 +01:00
Laurent MEUNIER c0ca0a7e2c STM I2C - move i2c_read in SYNC part
just change the place of code to have i2c_read and i2c_write together
2016-12-16 08:54:39 +01:00
Sam Grove 19acef97ee Merge pull request #3429 from LMESTM/fix_stm_i2c_fix_init
Fix stm i2c fix init
2016-12-15 10:35:13 -06:00
Laurent MEUNIER 57eb4a0d1d STM32 F1: move F1 to I2C common code
Now that F1 HAL has been updated to support required APIs,
the F1 family can also be moved to common code.
2016-12-14 08:36:30 +01:00
Laurent MEUNIER 77e202f064 STM32 I2C: use higher IRQ priority for slave vs. master 2016-12-13 11:59:12 +01:00
Laurent MEUNIER 36a0365d2d STM32 I2C: differentiate HW reset and driver reset
Make a distinct i2c_reset function as defined in MBED HAL api,
from the i2C_hw_reset which simply drives the HW reset signals
2016-12-12 17:33:14 +01:00
Laurent MEUNIER 6cdac88a1c SMT32 I2C: initialize clock before configuring PINs
This is needed especially for F1 family but can apply to all.
2016-12-12 14:52:11 +01:00
Laurent MEUNIER ee9c8acbe4 STM32 I2C: Initialize hz parameter before reset
The hz value is used to compute timeouts,
and timeout are used in reset function, so the parameter needs to be
initialized to its default value before being used.
2016-12-12 14:48:43 +01:00
Laurent MEUNIER 9895bcf130 STM32 I2C: restore slave address in case of reset 2016-12-12 14:44:37 +01:00
Laurent MEUNIER 29b32b84b3 STM32 I2C - 1MHZ frequency is allowed
So make the assert to cover all possible values
Also assert applies only for I2C_IP_VERSION_V2.
Also in case of I2C_IP_VERSION_V1, the HAL makes the proper
checks and can dynamically scale the frequency in case of
intermediate value.
2016-12-01 15:20:11 +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