Closed assasinfil closed 5 years ago
If you compiling with TARGET=BLUE_PILL
, then try to change these two lines: https://github.com/gl-sergei/chopstx/blob/984116b3b64b93f5a9e315f8a805db74f22fb90b/board/board-blue-pill.h#L12
Ideally, you should prepare header file for your board and add makefile target.
BTW, which board are you trying to run it on?
I work witch stm32f103c6 and led pin is PB12. I for a long time could not understand why the standard example blink does not work and having looked closely to the board I saw that the LED is connected to the foot of pb12
The LED should do some kind of work?
For PB12 it should look like
#define GPIO_LED_BASE GPIOB_BASE
#define GPIO_LED_CLEAR_TO_EMIT 12
and probably this line needs to be changed to something like
#define VAL_GPIO_LED_CRH 0x88838888 /* PB15...PB8 */
LED will blink when you plug the board and it will blink each time board communicates via USB.
i changed, but led didn't work(( maybe need change all lines?
I happened to have this board. Just tested it, it works with these changes:
diff --git i/board/board-blue-pill.h w/board/board-blue-pill.h
index 68843d7..8fe4fe9 100644
--- i/board/board-blue-pill.h
+++ w/board/board-blue-pill.h
@@ -9,8 +9,8 @@
#define STM32_PLLMUL_VALUE 9
#define STM32_HSECLK 8000000
-#define GPIO_LED_BASE GPIOC_BASE
-#define GPIO_LED_CLEAR_TO_EMIT 13
+#define GPIO_LED_BASE GPIOB_BASE
+#define GPIO_LED_CLEAR_TO_EMIT 12
#define GPIO_USB_BASE GPIOA_BASE
#define GPIO_USB_SET_TO_ENABLE 12
#undef GPIO_OTHER_BASE
@@ -29,8 +29,8 @@
#define VAL_GPIO_USB_CRH 0x88811888 /* PA15...PA8 */
#define VAL_GPIO_LED_ODR 0xFFFFFFFF
-#define VAL_GPIO_LED_CRL 0x88888888 /* PC7...PC0 */
-#define VAL_GPIO_LED_CRH 0x88388888 /* PC15...PC8 */
+#define VAL_GPIO_LED_CRL 0x88888888 /* PB7...PB0 */
+#define VAL_GPIO_LED_CRH 0x88838888 /* PB15...PB8 */
-#define RCC_ENR_IOP_EN (RCC_APB2ENR_IOPAEN | RCC_APB2ENR_IOPCEN)
+#define RCC_ENR_IOP_EN (RCC_APB2ENR_IOPBEN | RCC_APB2ENR_IOPCEN)
#define RCC_RSTR_IOP_RST (RCC_APB2RSTR_IOPARST | RCC_APB2RSTR_IOPCRST)
Make sure to run
make clean distclean && make TARGET=BLUE_PILL
after applying the patch.
Please also note that since your board does not have a push button to check for user presence, firmware will allow register/authenticate only within 10 seconds after device has been plugged in. You'll probably need to unplug the device and plug it back (or press HW reset button) to authenticate.
Nice its work! pls add it to compiler (Target=DARK_PILL)
The last question: where do I connect the button for authorization?
First, you will need to solder a push button. Then, you will need to modify pbt.c
to read events on this button's GPIO PIN and probably board-blue-pill.h
as well, to initialise that GPIO PIN.
For new makefile target I created https://github.com/gl-sergei/u2f-token/issues/10
How can I reassign LED pc13 to pb12 in the code?