Skip to main content
Visitor II
August 24, 2021
Question

Question about CMSIS driver

  • August 24, 2021
  • 2 replies
  • 2800 views

I've download the CMSIS pack for STM32H7 series. ST implement an I2C driver function like this:

int32_t I2C_MasterTransmit (uint32_t addr, const uint8_t *data, uint32_t  num, bool  xfer_pending, I2C_RESOURCES *i2c),

but the website,

https://arm-software.github.io/CMSIS_5/Driver/html/group__i2c__interface__gr.html, shows the API should be like this:

int32_t ARM_I2C_MasterTransmit (uint32_t addr, const uint8_t *data, uint32_t num, bool xfer_pending)

Why both the function name and parameters are different?

    This topic has been closed for replies.

    2 replies

    Super User
    August 24, 2021

    Seems like the ARM_I2C_MasterTransmit version has no provision for a chip with multiple I2C interface. The I2C_MasterTransmit looks like a rebranded HAL function.

    Super User
    August 25, 2021

    Asked this on the ARM forum. Lets' see if anybody actually uses this thing...

    JLee.32Author
    Visitor II
    August 25, 2021

    Not just I2C driver, I also check CAN driver, and it is also different.

    What I learn is that ARM define the API and IC suppliers implement the API, so they should match each other. Does someone know why they are different?

    Graduate II
    August 25, 2021

    Because the ARM definition seems a bit naive and isn't handling multiple instances of peripherals in a way C can handle cleanly/efficiently.

    Would have been better done in C++ classes.

    Don't expect the CMSIS implementation of this to gain much traction here.

    Perhaps you can explain to me how this would work? How would the function know what instance I'm using?

    drv_info = &Driver_I2C0;

    drv_info->MasterTransmit(..);

    JLee.32Author
    Visitor II
    August 25, 2021

    @Community member​ 

    Thanks for your reply. I understand what you mean. but I have two more questions.

    1) Why ARM keeps naive with latest version of CMSIS? No IC suppliers tell ARM this is wrong?

    2) IC suppliers is based on which API (or what document) to implement their driver for CMSIS? I checked CMSIS I2C drivers implemented by NXP and ST, The function name and parameters look the same. If ARM definition can not be followed, why IC suppliers can implement the same API (but different from ARM definition)?