cancel
Showing results for 
Search instead for 
Did you mean: 

SDA pin is required low by SI4703 Datasheet at startup. How do i do it.

Jurdus
Associate

I am trying to make a very simple program that will initialize Si4703 and read data out of it, the manufacturer ID or something.

And in the datasheet, it says to initialize the chip, I need to have SDIO turned low on the rising edge of the RST pin.

Si4702/03-C19 (page 19)

Jurdus_0-1753343042726.png

 

So the problem is that I can't pull SDIO low because in the code, the SDA pin is initialized as I2C and not as a GPIO set in the configurator. In the Arduino Library, the SDA is set as output, then written low, and then I2C is initialized. Would something like that work in CubeIDE? I am new to programming embedded chips, and I want to know how I can solve this problem.

Using the blackpill board with STM32F411C6EU and the Si4703 Tuner Board

1 ACCEPTED SOLUTION

Accepted Solutions
Andrew Neil
Super User

@Jurdus wrote:

In the Arduino Library, the SDA is set as output, then written low, and then I2C is initialized. Would something like that work in CubeIDE?


Of course it would.

The chip neither knows nor cares what development tools are used - it just sees what you do to the registers at run time.

The CubeIDE/CubeMX code generation is limited to only creating one configuration per pin - so you would have to do it manually.

As the I2C is significantly more complex than plain GPIO, I would suggest that you let CubeMX generate that, and do the GPIO bit manually.

You could use a separate CubeMX project to generate the GPIO config - then just copy that code into your "main" project with the I2C.

You can configure CubeMX to have it not generate calls to some or all of its generated initialisation functions

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

View solution in original post

4 REPLIES 4
Andrew Neil
Super User

@Jurdus wrote:

In the Arduino Library, the SDA is set as output, then written low, and then I2C is initialized. Would something like that work in CubeIDE?


Of course it would.

The chip neither knows nor cares what development tools are used - it just sees what you do to the registers at run time.

The CubeIDE/CubeMX code generation is limited to only creating one configuration per pin - so you would have to do it manually.

As the I2C is significantly more complex than plain GPIO, I would suggest that you let CubeMX generate that, and do the GPIO bit manually.

You could use a separate CubeMX project to generate the GPIO config - then just copy that code into your "main" project with the I2C.

You can configure CubeMX to have it not generate calls to some or all of its generated initialisation functions

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

@Andrew Neil wrote:

You could use a separate CubeMX project to generate the GPIO config - then just copy that code into your "main" project with the I2C.


This is probably easier if you use the option to generate separate .c & .h files:

AndrewNeil_0-1753346788142.png

#GenerateCandH #SeparateCandH

 


@Andrew Neil wrote:

You can configure CubeMX to have it not generate calls to some or all of its generated initialisation functions


Here:

AndrewNeil_1-1753346932938.png

#DisableInitCalls #DisableInitialisationCalls 

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
Ozone
Principal

> So the problem is that I can't pull SDIO low because in the code, the SDA pin is initialized as I2C and not as a GPIO set in the configurator. 

I think this is not correct, although I did not try this myself yet.
AFAIK you can write to the GPIO register for the respective pin to set it, even when it is configured as an "alternate function" (I2C).
Perhaps you better disable the I2C peripheral at that point, and you surely want not to interfere while any I2C transaction is ongoing.

Thank you, Neil. This is exactly what I needed.