From 3c0c9c2b33d4e6c31f01c569f621612d5f588e2d Mon Sep 17 00:00:00 2001 From: Mathieu Othacehe Date: Thu, 27 Jan 2022 15:50:47 +0100 Subject: [PATCH] STM32: increase i2c slave rx limit. Use uint16_t variables for i2c slave_rx_buffer_size and slave_rx_count variables. This allows to receive more than 255 bytes in slave mode. The bytes are received one by one in slave mode so there are no hardware limitations forcing a 1 byte rx count limit. --- targets/TARGET_STM/TARGET_STM32F0/objects.h | 4 ++-- targets/TARGET_STM/TARGET_STM32F1/objects.h | 4 ++-- targets/TARGET_STM/TARGET_STM32F2/objects.h | 4 ++-- targets/TARGET_STM/TARGET_STM32F3/objects.h | 4 ++-- targets/TARGET_STM/TARGET_STM32F4/objects.h | 4 ++-- targets/TARGET_STM/TARGET_STM32F7/objects.h | 4 ++-- targets/TARGET_STM/TARGET_STM32G0/objects.h | 4 ++-- targets/TARGET_STM/TARGET_STM32G4/objects.h | 4 ++-- targets/TARGET_STM/TARGET_STM32H7/objects.h | 4 ++-- targets/TARGET_STM/TARGET_STM32L0/objects.h | 4 ++-- targets/TARGET_STM/TARGET_STM32L1/objects.h | 4 ++-- targets/TARGET_STM/TARGET_STM32L4/objects.h | 4 ++-- targets/TARGET_STM/TARGET_STM32L5/objects.h | 4 ++-- targets/TARGET_STM/TARGET_STM32U5/objects.h | 4 ++-- targets/TARGET_STM/TARGET_STM32WB/objects.h | 4 ++-- targets/TARGET_STM/TARGET_STM32WL/objects.h | 4 ++-- 16 files changed, 32 insertions(+), 32 deletions(-) diff --git a/targets/TARGET_STM/TARGET_STM32F0/objects.h b/targets/TARGET_STM/TARGET_STM32F0/objects.h index 140b06048e..dbdadf9626 100644 --- a/targets/TARGET_STM/TARGET_STM32F0/objects.h +++ b/targets/TARGET_STM/TARGET_STM32F0/objects.h @@ -100,8 +100,8 @@ struct i2c_s { volatile uint8_t pending_slave_tx_master_rx; volatile uint8_t pending_slave_rx_maxter_tx; uint8_t *slave_rx_buffer; - volatile uint8_t slave_rx_buffer_size; - volatile uint8_t slave_rx_count; + volatile uint16_t slave_rx_buffer_size; + volatile uint16_t slave_rx_count; #endif #if DEVICE_I2C_ASYNCH uint32_t address; diff --git a/targets/TARGET_STM/TARGET_STM32F1/objects.h b/targets/TARGET_STM/TARGET_STM32F1/objects.h index c3610186e1..491cdd2e09 100644 --- a/targets/TARGET_STM/TARGET_STM32F1/objects.h +++ b/targets/TARGET_STM/TARGET_STM32F1/objects.h @@ -124,8 +124,8 @@ struct i2c_s { volatile uint8_t pending_slave_tx_master_rx; volatile uint8_t pending_slave_rx_maxter_tx; uint8_t *slave_rx_buffer; - volatile uint8_t slave_rx_buffer_size; - volatile uint8_t slave_rx_count; + volatile uint16_t slave_rx_buffer_size; + volatile uint16_t slave_rx_count; #endif #if DEVICE_I2C_ASYNCH uint32_t address; diff --git a/targets/TARGET_STM/TARGET_STM32F2/objects.h b/targets/TARGET_STM/TARGET_STM32F2/objects.h index 2bbc6f5729..e30629a09b 100644 --- a/targets/TARGET_STM/TARGET_STM32F2/objects.h +++ b/targets/TARGET_STM/TARGET_STM32F2/objects.h @@ -129,8 +129,8 @@ struct i2c_s { volatile uint8_t pending_slave_tx_master_rx; volatile uint8_t pending_slave_rx_maxter_tx; uint8_t *slave_rx_buffer; - volatile uint8_t slave_rx_buffer_size; - volatile uint8_t slave_rx_count; + volatile uint16_t slave_rx_buffer_size; + volatile uint16_t slave_rx_count; #endif #if DEVICE_I2C_ASYNCH uint32_t address; diff --git a/targets/TARGET_STM/TARGET_STM32F3/objects.h b/targets/TARGET_STM/TARGET_STM32F3/objects.h index 01d77e9aab..d69e9e7b6f 100644 --- a/targets/TARGET_STM/TARGET_STM32F3/objects.h +++ b/targets/TARGET_STM/TARGET_STM32F3/objects.h @@ -115,8 +115,8 @@ struct i2c_s { volatile uint8_t pending_slave_tx_master_rx; volatile uint8_t pending_slave_rx_maxter_tx; uint8_t *slave_rx_buffer; - volatile uint8_t slave_rx_buffer_size; - volatile uint8_t slave_rx_count; + volatile uint16_t slave_rx_buffer_size; + volatile uint16_t slave_rx_count; #endif #if DEVICE_I2C_ASYNCH uint32_t address; diff --git a/targets/TARGET_STM/TARGET_STM32F4/objects.h b/targets/TARGET_STM/TARGET_STM32F4/objects.h index 507ca3be7a..a71b3030b9 100644 --- a/targets/TARGET_STM/TARGET_STM32F4/objects.h +++ b/targets/TARGET_STM/TARGET_STM32F4/objects.h @@ -113,8 +113,8 @@ struct i2c_s { volatile uint8_t pending_slave_tx_master_rx; volatile uint8_t pending_slave_rx_maxter_tx; uint8_t *slave_rx_buffer; - volatile uint8_t slave_rx_buffer_size; - volatile uint8_t slave_rx_count; + volatile uint16_t slave_rx_buffer_size; + volatile uint16_t slave_rx_count; #endif #if DEVICE_I2C_ASYNCH uint32_t address; diff --git a/targets/TARGET_STM/TARGET_STM32F7/objects.h b/targets/TARGET_STM/TARGET_STM32F7/objects.h index d49ab8c1c6..ef8dc2919e 100644 --- a/targets/TARGET_STM/TARGET_STM32F7/objects.h +++ b/targets/TARGET_STM/TARGET_STM32F7/objects.h @@ -131,8 +131,8 @@ struct i2c_s { volatile uint8_t pending_slave_tx_master_rx; volatile uint8_t pending_slave_rx_maxter_tx; uint8_t *slave_rx_buffer; - volatile uint8_t slave_rx_buffer_size; - volatile uint8_t slave_rx_count; + volatile uint16_t slave_rx_buffer_size; + volatile uint16_t slave_rx_count; #endif #if DEVICE_I2C_ASYNCH uint32_t address; diff --git a/targets/TARGET_STM/TARGET_STM32G0/objects.h b/targets/TARGET_STM/TARGET_STM32G0/objects.h index 3673f6e755..55dea741ce 100644 --- a/targets/TARGET_STM/TARGET_STM32G0/objects.h +++ b/targets/TARGET_STM/TARGET_STM32G0/objects.h @@ -114,8 +114,8 @@ struct i2c_s { volatile uint8_t pending_slave_tx_master_rx; volatile uint8_t pending_slave_rx_maxter_tx; uint8_t *slave_rx_buffer; - volatile uint8_t slave_rx_buffer_size; - volatile uint8_t slave_rx_count; + volatile uint16_t slave_rx_buffer_size; + volatile uint16_t slave_rx_count; #endif #if DEVICE_I2C_ASYNCH uint32_t address; diff --git a/targets/TARGET_STM/TARGET_STM32G4/objects.h b/targets/TARGET_STM/TARGET_STM32G4/objects.h index 53098ec6bd..201d6671dd 100644 --- a/targets/TARGET_STM/TARGET_STM32G4/objects.h +++ b/targets/TARGET_STM/TARGET_STM32G4/objects.h @@ -113,8 +113,8 @@ struct i2c_s { volatile uint8_t pending_slave_tx_master_rx; volatile uint8_t pending_slave_rx_maxter_tx; uint8_t *slave_rx_buffer; - volatile uint8_t slave_rx_buffer_size; - volatile uint8_t slave_rx_count; + volatile uint16_t slave_rx_buffer_size; + volatile uint16_t slave_rx_count; #endif #if DEVICE_I2C_ASYNCH uint32_t address; diff --git a/targets/TARGET_STM/TARGET_STM32H7/objects.h b/targets/TARGET_STM/TARGET_STM32H7/objects.h index 6f17147886..cba64709df 100644 --- a/targets/TARGET_STM/TARGET_STM32H7/objects.h +++ b/targets/TARGET_STM/TARGET_STM32H7/objects.h @@ -120,8 +120,8 @@ struct i2c_s { volatile uint8_t pending_slave_tx_master_rx; volatile uint8_t pending_slave_rx_maxter_tx; uint8_t *slave_rx_buffer; - volatile uint8_t slave_rx_buffer_size; - volatile uint8_t slave_rx_count; + volatile uint16_t slave_rx_buffer_size; + volatile uint16_t slave_rx_count; #endif #if DEVICE_I2C_ASYNCH uint32_t address; diff --git a/targets/TARGET_STM/TARGET_STM32L0/objects.h b/targets/TARGET_STM/TARGET_STM32L0/objects.h index a94dd3f04f..8ed217b88e 100644 --- a/targets/TARGET_STM/TARGET_STM32L0/objects.h +++ b/targets/TARGET_STM/TARGET_STM32L0/objects.h @@ -116,8 +116,8 @@ struct i2c_s { volatile uint8_t pending_slave_tx_master_rx; volatile uint8_t pending_slave_rx_maxter_tx; uint8_t *slave_rx_buffer; - volatile uint8_t slave_rx_buffer_size; - volatile uint8_t slave_rx_count; + volatile uint16_t slave_rx_buffer_size; + volatile uint16_t slave_rx_count; #endif #if DEVICE_I2C_ASYNCH uint32_t address; diff --git a/targets/TARGET_STM/TARGET_STM32L1/objects.h b/targets/TARGET_STM/TARGET_STM32L1/objects.h index 91589c9a5b..148be365af 100644 --- a/targets/TARGET_STM/TARGET_STM32L1/objects.h +++ b/targets/TARGET_STM/TARGET_STM32L1/objects.h @@ -111,8 +111,8 @@ struct i2c_s { volatile uint8_t pending_slave_tx_master_rx; volatile uint8_t pending_slave_rx_maxter_tx; uint8_t *slave_rx_buffer; - volatile uint8_t slave_rx_buffer_size; - volatile uint8_t slave_rx_count; + volatile uint16_t slave_rx_buffer_size; + volatile uint16_t slave_rx_count; #endif #if DEVICE_I2C_ASYNCH uint32_t address; diff --git a/targets/TARGET_STM/TARGET_STM32L4/objects.h b/targets/TARGET_STM/TARGET_STM32L4/objects.h index 1748be2110..136a582b31 100644 --- a/targets/TARGET_STM/TARGET_STM32L4/objects.h +++ b/targets/TARGET_STM/TARGET_STM32L4/objects.h @@ -112,8 +112,8 @@ struct i2c_s { volatile uint8_t pending_slave_tx_master_rx; volatile uint8_t pending_slave_rx_maxter_tx; uint8_t *slave_rx_buffer; - volatile uint8_t slave_rx_buffer_size; - volatile uint8_t slave_rx_count; + volatile uint16_t slave_rx_buffer_size; + volatile uint16_t slave_rx_count; #endif #if DEVICE_I2C_ASYNCH uint32_t address; diff --git a/targets/TARGET_STM/TARGET_STM32L5/objects.h b/targets/TARGET_STM/TARGET_STM32L5/objects.h index c29d8cf344..c06bdd7171 100644 --- a/targets/TARGET_STM/TARGET_STM32L5/objects.h +++ b/targets/TARGET_STM/TARGET_STM32L5/objects.h @@ -120,8 +120,8 @@ struct i2c_s { volatile uint8_t pending_slave_tx_master_rx; volatile uint8_t pending_slave_rx_maxter_tx; uint8_t *slave_rx_buffer; - volatile uint8_t slave_rx_buffer_size; - volatile uint8_t slave_rx_count; + volatile uint16_t slave_rx_buffer_size; + volatile uint16_t slave_rx_count; #endif #if DEVICE_I2C_ASYNCH uint32_t address; diff --git a/targets/TARGET_STM/TARGET_STM32U5/objects.h b/targets/TARGET_STM/TARGET_STM32U5/objects.h index c3adc4bc55..a5e3d328e4 100644 --- a/targets/TARGET_STM/TARGET_STM32U5/objects.h +++ b/targets/TARGET_STM/TARGET_STM32U5/objects.h @@ -120,8 +120,8 @@ struct i2c_s { volatile uint8_t pending_slave_tx_master_rx; volatile uint8_t pending_slave_rx_maxter_tx; uint8_t *slave_rx_buffer; - volatile uint8_t slave_rx_buffer_size; - volatile uint8_t slave_rx_count; + volatile uint16_t slave_rx_buffer_size; + volatile uint16_t slave_rx_count; #endif #if DEVICE_I2C_ASYNCH uint32_t address; diff --git a/targets/TARGET_STM/TARGET_STM32WB/objects.h b/targets/TARGET_STM/TARGET_STM32WB/objects.h index 7fb437dc54..515846edcb 100644 --- a/targets/TARGET_STM/TARGET_STM32WB/objects.h +++ b/targets/TARGET_STM/TARGET_STM32WB/objects.h @@ -103,8 +103,8 @@ struct i2c_s { volatile uint8_t pending_slave_tx_master_rx; volatile uint8_t pending_slave_rx_maxter_tx; uint8_t *slave_rx_buffer; - volatile uint8_t slave_rx_buffer_size; - volatile uint8_t slave_rx_count; + volatile uint16_t slave_rx_buffer_size; + volatile uint16_t slave_rx_count; #endif #if DEVICE_I2C_ASYNCH uint32_t address; diff --git a/targets/TARGET_STM/TARGET_STM32WL/objects.h b/targets/TARGET_STM/TARGET_STM32WL/objects.h index 66f06eab28..a8fd7b93d3 100644 --- a/targets/TARGET_STM/TARGET_STM32WL/objects.h +++ b/targets/TARGET_STM/TARGET_STM32WL/objects.h @@ -106,8 +106,8 @@ struct i2c_s { volatile uint8_t pending_slave_tx_master_rx; volatile uint8_t pending_slave_rx_maxter_tx; uint8_t *slave_rx_buffer; - volatile uint8_t slave_rx_buffer_size; - volatile uint8_t slave_rx_count; + volatile uint16_t slave_rx_buffer_size; + volatile uint16_t slave_rx_count; #endif #if DEVICE_I2C_ASYNCH uint32_t address;