Main Site Documentation

I2C more pins - TinyCLR Port


#1

I’m trying to declare more I2C pins based on mbed file

when from declared part

// I2C
define STM32F4_I2C_PORT 1
define STM32F4_I2C_SCL_PIN _P(B, 8)
define STM32F4_I2C_SDA_PIN _P(B, 9)

when i want to expand declaration with more than 1 I2C Ports
like below

// I2C
define STM32F4_I2C_PORT 3
define STM32F4_I2C_SCL_PIN { _P(B, 8) , _P(B, 10) , _P(B, 4) }
define STM32F4_I2C_SDA_PIN { _P(B, 9) , _P(B, 3) , _P(A, 8) }

i’ve got error like below

C:\TinyCLRPorts050\Targets\STM32F4\STM32F4_I2C.cpp
In file included from C:\TinyCLRPorts050\Targets\STM32F4\STM32F4.h:22:0,
from C:\TinyCLRPorts050\Targets\STM32F4\STM32F4_I2C.cpp:17:
C:\TinyCLRPorts050\Targets\STM32F4\STM32F4_I2C.cpp: In function ‘TinyCLR_Result STM32F4_I2c_Acquire(const TinyCLR_I2c_Provider*)’:
C:\TinyCLRPorts050\Devices\NUCLEO411RET6/DeviceSelector.h:93:41: error: expected primary-expression before ‘{’ token
#define STM32F4_I2C_SDA_PIN { _P(B, 9) , _P(B, 3) , _P(A, 8) }
^
C:\TinyCLRPorts050\Targets\STM32F4\STM32F4_I2C.cpp:352:60: note: in expansion of macro 'STM32F4_I2C_SDA_PIN’
uint32_t altMode = (uint32_t)(STM32F4_I2C_PORT == 2 && STM32F4_I2C_SDA_PIN == 25 ? 0x93 : 0x43);
^~~~~~~~~~~~~~~~~~~
C:\TinyCLRPorts050\Devices\NUCLEO411RET6/DeviceSelector.h:93:41: error: expected ‘)’ before ‘{’ token
#define STM32F4_I2C_SDA_PIN { _P(B, 9) , _P(B, 3) , _P(A, 8) }

i’m going to draw maximum what i can get from nucleo

3 UART
5 SPI
3 I2C

if possible with TinyCLROS


#2

The current STM32F4 driver only supports a single I2C channel since it was inherited from NETMF. A future release will lift that limitation.

That said, the managed driver should work with as many I2C channels as the native provider makes available. So you may be able to change the STM32F4 I2C driver yourself to make it work, though we haven’t tested it yet.


#3

@John_Brochue
thanx a lot for info