mirror of
https://github.com/strfry/rtl8710-stlink-tutorial.git
synced 2024-11-25 15:34:17 +00:00
How to flash RTL8710/RtlDuino with STM32 Discovery Board
README.md | ||
rtlduino-pinout.png |
Program rtl8170 (RtlDuino) with STM32 Discovery Board
- Disconnect CN3 Jumpers (inside 'ST-LINK DISCOVERY' label)
- Connect to SWD (CN2) pins with jumpwires to rtlduino board (see rtlduino-pinout.png): Pin 2 <> CLK Pin 3 <> GND Pin 4 <> TMS (Pin 5) <> TRST
- Connect any 5V pin on STM board to 5VDD
- Install OpenOCD >= version 0.9, and install gcc-arm-none-eabi
- git checkout https://bitbucket.org/rebane/rtl8710/src
- Replace in Makefile "interface/stlink-v2-1.cfg" with "interface/stlink-v2.cfg"
diff --git Makefile Makefile
index 4581f9a..66a3be5 100644
--- Makefile
+++ Makefile
@@ -24,8 +24,8 @@ clean:
rm -rf $(FILENAME_PREFIX).bin $(FILENAME_PREFIX).elf
install:
- openocd -f interface/stlink-v2-1.cfg -f rtl8710.ocd -f cortex/cortex.ocd -c "init" -c "reset halt" -c "load_image $(FILENAME_PREFIX).bin $(ADDRESS) bin" -c "cortex_bootstrap $(ADDRESS)" -c "shutdown"
+ openocd -f interface/stlink-v2.cfg -f rtl8710.ocd -f cortex/cortex.ocd -c "init" -c "reset halt" -c "load_image $(FILENAME_PREFIX).bin $(ADDRESS) bin" -c "cortex_bootstrap $(ADDRESS)" -c "shutdown"
reset:
- openocd -f interface/stlink-v2-1.cfg -f rtl8710.ocd -c "init" -c "reset halt" -c "reset run" -c "shutdown"
+ openocd -f interface/stlink-v2.cfg -f rtl8710.ocd -c "init" -c "reset halt" -c "reset run" -c "shutdown"
- Change blinking GPIO to RtlDuino's onboard LED:
diff --git main.c main.c
index f32c716..b18b811 100644
--- main.c
+++ main.c
@@ -8,12 +8,12 @@ void delay(uint32_t delay){
int main(){
*(volatile uint32_t *)0x4000021C |= (((uint32_t)1) << 8); // REG_SOC_PERI_FUNC1_EN |= BIT_PERI_GPIO_EN; (enable gpio peripheral)
- *(volatile uint32_t *)0x40001004 |= (((uint32_t)1) << 8); // GPIO_PORTA_DDR |= ...???; (set gpio to output, GC4 on B&T RTL-00)
+ *(volatile uint32_t *)0x40001004 |= (((uint32_t)1) << 6); // GPIO_PORTA_DDR |= ...???; (set gpio to output, GC4 on B&T RTL-00)
while(1){
- *(volatile uint32_t *)0x40001000 |= (((uint32_t)1) << 8); // GPIO_PORTA_DR |= ...???; (pin high)
+ *(volatile uint32_t *)0x40001000 |= (((uint32_t)1) << 6); // GPIO_PORTA_DR |= ...???; (pin high)
delay(1000000);
- *(volatile uint32_t *)0x40001000 &= ~(((uint32_t)1) << 8); // GPIO_PORTA_DR &= ~...???; (pin low)
+ *(volatile uint32_t *)0x40001000 &= ~(((uint32_t)1) << 6); // GPIO_PORTA_DR &= ~...???; (pin low)
delay(1000000);
}
}