daniel-thompson / i2c-star

A clone of the i2c-tiny-usb based upon STM32 and libopencm3
GNU General Public License v3.0
124 stars 31 forks source link

Possible for this to work on ST-LINK module? #1

Closed brunnels closed 7 years ago

brunnels commented 9 years ago

I'm wondering if you think it's possible to get this running on the ST-LINK that comes with the stm8s-discovery. http://st.com/stm8s-discovery The ST-LINK usb programmer for the stm8s has a STM32F103C8T6 processor. Hardware docs and schematics are here: http://www.st.com/st-web-ui/static/active/en/resource/technical/document/user_manual/CD00250600.pdf page 16

daniel-thompson commented 9 years ago

Yes. If you can find a way to flash it then it looks to me like the firmware should would work out the box. As luck would have it the I2C clock end up on the RST pin and the data on the SWIM pin).

To get things working electrically then you will probably have to "snap off" the programmer from the STM8 board since there is a capacitor (C1) in the reset circuit of the main board that would probably interfere with the clock signal.

Other electrical matters are that the data pin already has a 680 ohm pull up together with some other small value current limiting resistors but the clock line does not. This could go either way... you might have to make sure there is a pull up on the clock line or you might have to depopulate R12 because there is too much pull up! It really depends on the board you hook up.

BTW... I mostly connect one of these to my i2c-star and, curiously, appears to works OK without any pull ups:

http://www.ebay.co.uk/itm/0-96-I2C-IIC-SPI-Serial-128X64-OLED-LCD-LED-Display-Module-for-Arduino-white-BT-/121476042928?pt=UK_Computing_Other_Computing_Networking&hash=item1c488950b0

No promises it will work for you but boards like this are pretty cheap and, if you can get it running, lots of fun to play with.

brunnels commented 9 years ago

Thanks for the info. I had this one on-hand already and if it's just depopulate a few pads and good to go then awesome. I have the parts on-hand to build a standard attiny board too but this would be nice than doing up a protoboard.

Any pointers or links on how to go about flashing it? I have a lot of atmega experience but no STM experience.

daniel-thompson commented 9 years ago

In the i2c-star source base try: make -C src/bootloader flash V=1

Assuming you have the arm-gcc-embedded toolchain installed to actually build the loader then the final line will be the command to do the flashing together with a configuration file to get that running using the one wire protocol (plus a rst wire).

You use an stlink to do the programming. If you have two STM8 boards it means linking up wires from CN7 on one board to CN5 on the other. BTW I suspect that the original code in the flash is protected, this means you will have to clear the flash using a special OpenOCD command before doing anything else.

Feel free to ping my by IRC (you will probably recognise me by my usercode on the #libopencm3 channel).

daniel-thompson commented 9 years ago

BTW I just took a quick link on your github page. Perhaps I should have done that first since I would have ended up typing a lot less about I2C electrical stuff if I'd noticed that.