Skip to content

UBLOX C030: I2C avoid any RTOS waits #6117

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 19, 2018
Merged

Conversation

bqam-ublox
Copy link
Contributor

@bqam-ublox bqam-ublox commented Feb 16, 2018

Description

Type: Enhancement
Related issues: #5957, #5995, #6011 and #6034
Fixes issues: #5995, #6011
Priority: Blocker

Replacing i2c_read/i2c_write function calls in boot code with i2c_byte_read/i2c_byte_write. This PR addresses the following:

  1. Reduces the binary size overhead to ~0.5 KB

  2. The C++ BatteryChargerI2c class previously introduced for C030 Battery Charger Voltage Fix #5677 has been eliminated as the I2C is now using different functions and does not require the initialization parameters which were necessary in the previous case.

  3. The functions i2c_byte_read/i2c_byte_write functions in the STM HAL are not using the wait_us() functions so for now a target hook post-RTOS-initiailisation is not required.

  4. The platform critical section tests which were failing previously (C030 boards fail new platform critical section test  #5995) are all passing now (except a few but they are not related to this PR).

@RobMeades @LMESTM @0xc0170 please review

@mbed-ci
Copy link

mbed-ci commented Feb 16, 2018

--none--

char read_from_i2c(int slave_addr, int reg_addr, int* data_read, i2c_t i2c_obj)
{
char ret_code = 0;
if(!i2c_start(&i2c_obj)){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you use if () - space there, then { } for each if this is lot of conditions, would it make sense to squeeze in if (start && write && write ....) ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

data_read = data_read & MIN_BATTERY_VOLTAGE_MASK;
write_to_i2c(BQ24295_I2C_ADDRESS, 0, data_read, i2c_obj);
//Battery Voltage is set to 3880mV
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

} else {

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 19, 2018

/morph build

@mbed-ci
Copy link

mbed-ci commented Feb 19, 2018

Build : SUCCESS

Build number : 1167
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6117/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

Copy link
Contributor

@RobMeades RobMeades left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@LMESTM
Copy link
Contributor

LMESTM commented Feb 19, 2018

Glad to see this alternative can unblock the situation :-)

@mbed-ci
Copy link

mbed-ci commented Feb 19, 2018

@mbed-ci
Copy link

mbed-ci commented Feb 19, 2018

@0xc0170
Copy link
Contributor

0xc0170 commented Feb 19, 2018

Needs a restart, was aborted

/morph test

@mbed-ci
Copy link

mbed-ci commented Feb 19, 2018

@0xc0170 0xc0170 changed the title Using alternative I2C functions from STM HAL to reduce binary size and avoid any RTOS waits UBLOX C030: I2C avoid any RTOS waits Feb 19, 2018
@0xc0170 0xc0170 merged commit 105da03 into ARMmbed:master Feb 19, 2018
@bqam-ublox bqam-ublox deleted the i2c_read_write branch February 21, 2018 06:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants