-
Notifications
You must be signed in to change notification settings - Fork 3
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
Pin remapping? #1
Comments
Yup, just half-figured it out now:
But I need to remap some pins since those used in EDIT diff --git a/Embed.toml b/Embed.toml
index 1cfda2f..e935b9d 100644
--- a/Embed.toml
+++ b/Embed.toml
@@ -1,6 +1,6 @@
[default.probe]
usb_vid = "0483"
-usb_pid = "374b"
+usb_pid = "3748" // using a chinese stlinkv2 clone of a clone (CK32) for SWD flashing
protocol = "Swd"
[default.flashing]
diff --git a/src/main.rs b/src/main.rs
index 7de8ec3..b1d4813 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -38,13 +38,14 @@ fn main() -> ! {
let mut rcc = rcc_cfgr.sysclk(48.mhz()).pclk(48.mhz()).freeze(&mut dp.FLASH);
let gpioa = dp.GPIOA.split(&mut rcc);
+ let gpiob = dp.GPIOB.split(&mut rcc);
// Construct fake critical section
let cs = unsafe { core::mem::zeroed() };
- let tms = gpioa.pa4.into_push_pull_output_hs(&cs);
- let tck = gpioa.pa5.into_push_pull_output_hs(&cs);
- let tdo = gpioa.pa6.into_floating_input(&cs);
- let tdi = gpioa.pa7.into_push_pull_output_hs(&cs);
+ let tms = gpioa.pa15.into_push_pull_output_hs(&cs); // was 4
+ let tck = gpiob.pb5.into_push_pull_output_hs(&cs); // was 5
+ let tdo = gpiob.pb4.into_floating_input(&cs); // was 6
+ let tdi = gpiob.pb3.into_push_pull_output_hs(&cs); // was 7
drop(cs);
let hw = Hardware::new(); I guess you are setting the regs on BSRR via statements like this?: LDR R4, =0x00a00080 // R4 <- [TCK0+TDI0+TDI1] I'll have to get more familiar with that |
Essentially I would like to do this re-mapping of the pins: diff --git a/asm.s b/asm.s
index 4f7ba11..0b0da23 100644
--- a/asm.s
+++ b/asm.s
@@ -2,10 +2,10 @@
// GPIOA.IDR: 0x48000010
// GPIOA.BSRR: 0x48000018
-// TCK: 5
-// TDI: 7
-// TDO: 6
-// TMS: 4
+// TCK: B5 (was A5)
+// TDI: B3 (was A7)
+// TDO: B4 (was A6)
+// TMS: A15 (was A4) But it'll take a while longer (for me) to do parse through the |
Assembly file makes a lot of assumptions about pins used. The implementation assumes fixed pin numbers (listed at the top) as well as all pins sitting on the same GPIO port. If you use different pins, you will have to rewrite a lot of assembly code. For RISC-V I used the same command mentioned in the longan-nano repo: |
I flashed it successfully on a f042 dev board, but I wonder which interface config to use on OpenOCD given the USB VID:PID?:
Just a side note as I go, I'll probably figure out myself with some trial and error, but it would be nice to have it right away on the README.md... for instance the commands you used to talk to the RISCV test you mentioned on twitter? ;)
The text was updated successfully, but these errors were encountered: