Commit Graph

80 Commits (7cb61d9edf84b18ffe8eba41084679e555fabbac)

Author SHA1 Message Date
Jamie Smith 7cb61d9edf Rework STM32H7x clocking configuration 2024-04-16 00:24:09 -07:00
Jamie Smith e7fb3b8076 Fix repeated start for transactional I2C API on STM32 devices with I2C v2 2023-03-21 22:43:10 -07:00
Charles e55852ca55
fixed compiler inline issue 2023-02-22 16:06:07 +01:00
Jamie Smith 0751932dd3 Rethink STM32 I2C v2 HAL 2022-11-27 21:14:58 -08:00
Martin Kojtal 0b9a7740d5
Merge pull request #15099 from jeromecoutant/PR_H723
STM32H7: enable more custom boards
2021-09-29 15:18:00 +01:00
Jerome Coutant da903bf057 STM32H7 add subfamilies for custom boards
- STM32H723xG
- STM32H725xE
- STM32H750xB
2021-09-22 15:13:31 +02:00
Jerome Coutant b711180838 STM32G0: update from STM32Cube_FW_G0_V1.5.0 2021-09-21 11:29:33 +02:00
pennam ccf8995858 STM32 Fix i2c_compute_timing() API 2021-07-13 14:07:12 +02:00
Affrin Pinhero d8cbd68dc2 driver/i2c: STM32: Solves I2C driver performanc issue.
This commit solves issue related to i2c driver performance.
With this commit delay in read write when using i2c timing
algorithm is solved. Used flag mechanism which will check
tim reg value and hz passed.

Signed-off-by: Affrin Pinhero <affrin.pinhero@hcl.com>
2021-07-02 10:54:16 +05:30
Martin Kojtal 8188f5f5ab
Merge pull request #14776 from affrinpinhero-2356/i2c_longTime_Mem_Solve
driver/i2c: STM32: I2C memory usage and time delay in read-write solved.
2021-06-29 11:30:02 +02:00
Affrin Pinhero 8f24f09df7 driver/i2c: STM32: Solves excess memory usage issue.
This commit solves excess usage of RAM. User can now enable/disable
I2C timing algorithm. Disabling of I2C timing algorithm would
reduce RAM usage.

Signed-off-by: Affrin Pinhero <affrin.pinhero@hcl.com>
2021-06-28 18:13:02 +05:30
Martin Kojtal b74f62c974
Merge pull request #14659 from arduino/i2c_slave_patch
STM32: make i2c_salve_read return the number of bytes read
2021-06-10 14:10:31 +02:00
Affrin Pinhero 4a8b2301a5 STM32: Fixed I2C Bug reported.
Modified HAL_I2C_ErrorCallback function to solve bug reported in I2C Driver.
This commit solves compilation error occured when DEVICE_I2CSLAVE is not defined.

fix #14696

Signed-off-by: Affrin Pinhero <affrin.pinhero@hcl.com>
2021-05-27 15:02:39 +05:30
pennam d317dfccbb make i2c_salve_read return the number of bytes read to let mbed-os read API return an error if less bytes are readed 2021-05-25 08:46:02 +02:00
Anna Bridge 10a2da9b5e
Merge pull request #14668 from ikmdani/fix_i2c_read_13967
Driver: I2C: STM32F2/STM32F4/STM32L1: Fix alternate i2c read.
2021-05-24 13:14:36 +01:00
Anna Bridge 5ef56cc6f4
Merge pull request #14557 from affrinpinhero-2356/feature_i2cTiming_Calculation
STM32: driver/Added I2C timing calculation algorithm
2021-05-24 13:09:19 +01:00
Affrin Pinhero d974b47439 driver/i2c: Added I2C timing calculation function.
This commit adds I2C timing value automatic calculation algorithm
for all supported families added. This patch improves I2C timing calculation
according to I2C input clock and I2C bus speed.
This commit also allows user to change the system clock and I2C input clock.

Related issue: #12907

Pull request type:
[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results:
[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Signed-off-by: Affrin Pinhero <affrin.pinhero@hcl.com>
2021-05-19 18:35:47 +05:30
Krishna Mohan Dani 8f2c45c5af Driver: I2C: STM32F4: Fix for every alternate i2c read failure in F2, F4 & L1 families.
This commit fixes the i2c driver issue reported in the below link:
https://github.com/ARMmbed/mbed-os/issues/13967 on STM32F4xx platform.

The data type of XferOperation has been changed from uint8_t to uint32_t
so that it can hold a 32bit value (for example: I2C_OTHER_FRAME or
I2C_OTHER_AND_LAST_FRAME).

Signed-off-by: Krishna Mohan Dani <krishnamohan.d@hcl.com>
2021-05-17 18:20:00 +05:30
Affrin Pinhero b5f864d96d Updated HAL_I1C_ErrorCallback funtion to store information about error reason in obj_s->event. This will help user or application to check the reason for the error caused. This address the issue reported in the below link: ARMmbed/mbed-os#14059
Summary of changes:

Impact of changes

Migration actions required

Pull request type
[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[x] Covered by existing mbed-os tests (Greentea or Unittest)
[] Tests / results supplied as part of this PR

Signed-off-by: Affrin Pinhero <affrin.pinhero@hcl.com>
2021-05-06 14:37:04 +05:30
jeromecoutant 34f02ff573 STM32 I2C : correct deinit
Set port mode back to Analog (reset value)
2021-03-16 15:05:37 +01:00
Martin Kojtal 1dd411268b
Merge pull request #14030 from arduino/i2c_stm32_wrong_clock
STM32H7: Compute I2C timing according current I2C clock source
2021-02-15 14:38:11 +00:00
jeromecoutant 4550f92565 STM32WL : I2C full support 2021-02-08 17:19:05 +01:00
reme 5a2835c18c STM32WL : ADDING STM32 SUPPORT
Add code concerning all STM32 platforms
2021-02-05 08:04:31 +00:00
pennam 6db7342cf6 manage I2C_IP_VERSION_V1 boards builds 2021-02-03 15:14:42 +01:00
pennam 506390bcf8 Increase FLAG_TIMEOUT to avoid misleading triggers 2021-02-01 09:13:33 +01:00
pennam 7544f7ef24 Use the proper clock source for any I2C instance 2021-02-01 09:13:21 +01:00
jeromecoutant b01940200c STM32 I2C: use correct HAL API 2020-11-19 12:03:48 +01:00
jeromecoutant bc4bc05908 STM32 warning remove 2020-04-24 10:57:45 +02:00
Maciej Bocianski 0b634e54b4 implement i2c_free for STM family 2020-01-31 14:51:54 +01:00
jeromecoutant c1386cf52d STM32L5 : update generic STM files for L5 2020-01-23 17:54:55 +01:00
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