Hack STM32F405 on the PHS Shield

Dependencies:   mbed

MCU_SWD

123456
SWCLKGNDSWDIORESETJTDO

MCU_UART

12345
RXTXGND

Files at this revision

API Documentation at this revision

Comitter:
phsfan
Date:
Mon May 11 15:15:44 2015 +0000
Commit message:
1st build;

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 90cbfc14fcb7 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon May 11 15:15:44 2015 +0000
@@ -0,0 +1,43 @@
+/*
+ * select: Nucleo F401RE
+ */
+#include "mbed.h"
+
+Serial pc(PB_6, PB_7);
+
+Serial phs(PA_2, PA_3);
+DigitalOut rts(PA_1);
+DigitalIn cts(PA_0);
+
+DigitalOut led1(PC_6), led2(PC_7);
+DigitalOut pwr1(PC_9);
+DigitalIn pwr2(PA_8);
+
+
+int main() {
+    pc.baud(115200);
+    phs.baud(120000);
+    pwr1 = 0; // DCDC enable
+    pwr2.mode(PullUp);
+    GPIOB->MODER = (GPIOB->MODER & ~(3<<22)) | (1<<22); // PB_11 output
+    GPIOB->OTYPER = (1<<11); // open drain
+    GPIOB->ODR &= ~(1<<11); // reser=0
+//    phs.set_flow_control(Serial::RTSCTS, PA_1, PA_0);
+    cts.mode(PullUp);
+    rts = 0;
+    wait_ms(100);
+    GPIOB->MODER &= ~(3<<22); // PB_11 input
+    GPIOB->PUPDR = (GPIOB->MODER & ~(3<<22)) | (1<<22); // pullup
+
+    pc.printf("*** PHSShield STM32F405\r\n");    
+
+    for (;;) {
+        if (phs.readable()) {
+            pc.putc(phs.getc());
+        }
+        if (pc.readable()) {
+            phs.putc(pc.getc());
+        }
+        led2 = cts;
+    }
+}
diff -r 000000000000 -r 90cbfc14fcb7 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 11 15:15:44 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8ab26030e058
\ No newline at end of file