Giter Site home page Giter Site logo

Comments (17)

chris-durand avatar chris-durand commented on May 9, 2024 1

I looked at the reference manuals yesterday. stm32-extended and stm32l4 are in fact the same implementation. The memory maps and features seem to be completely identical except for the WUPEN bit (Wakeup from Stop mode enable) in I2C_CR1 that is missing on some controllers (some F0, F7 ?).

I would suggest to rename the L4 I2C to stm32-extended and enable it for all the other controllers. That would need some changes in the L4 I2C driver and device file generator. The name stm32-extended is problably ok because it supports more features than the other I2C IP (Fast Mode Plus support).

from modm.

chris-durand avatar chris-durand commented on May 9, 2024 1

This data is available because for FastModePlus the io pin has to be configured in SYSCFG_CFGR1 to a special mode that can drive the I2C bus with 20mA.

from modm.

chris-durand avatar chris-durand commented on May 9, 2024

It's not that easy, thank you ST:
image

I hope this is somewhere in the CubeMX data…
However, we do not support any of these optional features right now.

from modm.

rleh avatar rleh commented on May 9, 2024

STM32F0 reference manual: I2C register CR1
The WUPEN bit is not used by the modm anyway, so we can simply ignore it.

I remember that the digital noise filter DNF is not available on all controllers.

from modm.

chris-durand avatar chris-durand commented on May 9, 2024

I remember that the digital noise filter DNF is not available on all controllers.

I think this is only true for the other IP. If I didn't overlook anything the DNF bits are available in all controllers that have the extended IP.

from modm.

chris-durand avatar chris-durand commented on May 9, 2024

@rleh Are you currently working on this? It wouldn't be very efficient if we end up with 2 PRs implementing the same thing.

from modm.

rleh avatar rleh commented on May 9, 2024

image
image
image
image
image

At least the feature tables are similar in the reference manuals...

from modm.

rleh avatar rleh commented on May 9, 2024

CubeMX has data about e.g. FastModePlus:

<RefParameter Name="GPIO_FM6" Comment="Fast Mode" Type="list" DefaultValue="__NULL">
	<PossibleValue Value="__NULL" Comment="Disable"/>
	<PossibleValue Value="I2C_FASTMODEPLUS_PB6" Comment="Enable"/>
</RefParameter>
<RefParameter Comment="I2C Speed Mode " DefaultValue="I2C_Standard" Group="Timing configuration" Name="I2C_Speed_Mode" Type="list">
	<PossibleValue Comment="Standard Mode" Value="I2C_Standard"/>
	<PossibleValue Comment="Fast Mode" Value="I2C_Fast"/>
	<PossibleValue Comment="Fast Mode Plus" Semaphore="$IpInstance_FastMP" Value="I2C_Fast_Plus"/> 
</RefParameter>

But I don't know where $IpInstance_FastMP is defined πŸ˜’

from modm.

rleh avatar rleh commented on May 9, 2024

Are you currently working on this? It wouldn't be very efficient if we end up with 2 PRs implementing the same thing.

No.

from modm.

chris-durand avatar chris-durand commented on May 9, 2024

According to CubeMX every device with the stm32-extended IP supports FM+ except I2C instance 2 on devices that match STM32F030C8Tx|STM32F030R8Tx|STM32F051R8Tx|STM32F051C8Tx|STM32F051R8Ux|STM32F051C8Ux|STM32F0x0_Value_Line.

All instances of stm32-extended support SMBus except I2C2 on F0/L0.

This data is somehow contradictory to the reference manuals. STM32F05xxx have no FM+ but I can configure it in CubeMX for STM32F058x8. The correct rule according to the reference manual is that every instance supports FM+ except for I2C2 on F03x, F05x and F070xB devices.

from modm.

strongly-typed avatar strongly-typed commented on May 9, 2024

Is there a way in lbuild to see if there are multiple instances of the peripheral?

in module.lb:

properties["aid"] = "2" if self.instance == 4 else "1"

but ST sometimes leaves out the postfix 1 if there is only one peripheral.

Or should I just create an alias between APB1RSTR and APB1RSTR1?

from modm.

salkinium avatar salkinium commented on May 9, 2024

Is there a way in lbuild to see if there are multiple instances of the peripheral?

You mean like this?

has_instances = "instance" in device.get_driver("i2c")

This is just a dictionary, so you can always use the get(key, default) function: device.get_driver("i2c").get("instance", []).

from modm.

salkinium avatar salkinium commented on May 9, 2024

The above is an issue in the CAN drivers, where there's CAN or CAN1 and/or CAN2. We follow the reference manual naming here, since we don't want to rename stuff (that gets you into trouble).

from modm.

chris-durand avatar chris-durand commented on May 9, 2024

in module.lb:

properties["aid"] = "2" if self.instance == 4 else "1"

but ST sometimes leaves out the postfix 1 if there is only one peripheral.

Or should I just create an alias between APB1RSTR and APB1RSTR1?

This is probably not the right solution to this problem. This relation only holds for some L4. For instance, STM32F745 has 4 I2Cs but no APB1RSTR1.

from modm.

chris-durand avatar chris-durand commented on May 9, 2024

Or should I just create an alias between APB1RSTR and APB1RSTR1?

L4 controllers have APB1RSTR1/APB1RSTR2, all the others APB1RSTR. That should be manageable.

from modm.

strongly-typed avatar strongly-typed commented on May 9, 2024

There is a little FIXME we/I need to fix. Blame me :-O

The timing blob was taken from the CubeMX. Does anybody know how to calculate these settings? Is a LUT with a bunch of common frequencies an intermediate solution?

from modm.

salkinium avatar salkinium commented on May 9, 2024

Closed in #118.

from modm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.