Skip to content
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

I2C address 0x30 is unchangeable #3

Closed
cax opened this issue Oct 29, 2017 · 7 comments

Comments

Projects
None yet
6 participants
@cax
Copy link

commented Oct 29, 2017

By hardware design, the motor shield allows selecting one of four i2c addresses (0x2d, 0x2e, 0x2f , 0x30) by soldering connection between relevant pads (AD0, AD1) on the shield.

At the moment, the alternative firmware has 0x30 as a hard-coded address, which does not allow using of more then one shield in the project.

There are 2 possible solutions I can think of:

  1. re-implement the pad-soldering address selection feature

  2. compile and publish 4 different firmware binaries, each for different hard-coded i2c address from the 0x2d-0x30 range.
    Shield users will choose the address and flash the relevant firmware bin file.

It should be easy for you, as you already have the compilation toolchain installed.
Thank you in advance!

@cax

This comment has been minimized.

Copy link
Author

commented Oct 31, 2017

Here are the lines from the original firmware source code that may be helpful:

#define AD0_Pin GPIO_PIN_0
#define AD0_GPIO_Port GPIOF
#define AD1_Pin GPIO_PIN_1
#define AD1_GPIO_Port GPIOF

uint8_t i2c_base_add=0x2d;
uint8_t ad0_val,ad1_val;

MX_GPIO_Init();

ad0_val=HAL_GPIO_ReadPin(AD0_GPIO_Port,AD0_Pin);
ad1_val=HAL_GPIO_ReadPin(AD1_GPIO_Port,AD1_Pin);

i2c_base_add+=((ad1_val)<<1)|ad0_val;

hi2c1.Init.OwnAddress1 = i2c_base_add<<1;

@cax

This comment has been minimized.

Copy link
Author

commented Nov 1, 2017

I had no patience, so I installed the toolchain, patched the value of 0x60 (2 * 0x30) in main.c to suit addresses 0x2d, 0x2e, 0x2f , 0x30, compiled firmware for each address, flashed and tested with motor shield.

Now it's possible to use more than one motor shield at once.

Attached is the zip with firmware files for 4 different addresses.

motor_shield_XX_bin.zip

@ashishgururani

This comment has been minimized.

Copy link

commented Nov 8, 2017

I was looking for this so bad and had no idea how to "install the toolchain". Thank you so much for this.. testing it now!

@NathanJPhillips

This comment has been minimized.

Copy link
Contributor

commented Nov 22, 2017

I have a branch to fix the firmware to use the solder pads on the back here: https://github.com/NathanJPhillips/wemos_motor_shield/commits/feature/address-select
I will test it when I get time, which should be by the weekend. It builds on #6 so if we can get that one reviewed first then it will speed up incorporation of the next PR once I've done the testing.

@sprat

This comment has been minimized.

Copy link

commented Jan 18, 2018

I'm interested by the firmware fix, but I see that the merge request upon which it builds has been closed. What is the status of this branch? Has it been tested?

@danielfmo

This comment has been minimized.

Copy link
Contributor

commented Aug 11, 2018

Please check this PR to address this issue
#8

@pbugalski

This comment has been minimized.

Copy link
Owner

commented Aug 12, 2018

Solved, thank you danielfmo for your help.

@pbugalski pbugalski closed this Aug 12, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.