Closed cax closed 6 years ago
Here are the lines from the original firmware source code that may be helpful:
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;
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.
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!
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 https://github.com/pbugalski/wemos_motor_shield/pull/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.
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?
Please check this PR to address this issue https://github.com/pbugalski/wemos_motor_shield/pull/8
Solved, thank you danielfmo for your help.
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!