document project

This commit is contained in:
King Kévin 2020-10-11 12:46:53 +02:00
parent 804ba7628b
commit fcafec7cc6
1 changed files with 55 additions and 46 deletions

101
README.md
View File

@ -1,64 +1,73 @@
This firmware template is designed for development boards based around [STM32 F1 series micro-controller](http://www.st.com/web/en/catalog/mmc/FM141/SC1169/SS1031).
SK6812RGBW DIN, PB15, SPI2_MOSI
CATALEX RX, PA2, USART2_TX
CATALEX TX, PA3, USART3_RX
SK6812RGBW LED string
orange: gnd
green: 5v
yellow: din
This is the firmware for the Dachboden Klo-Assistant.
project
=======
summary
-------
This project's original purpose was to indicate the occupancy state of the toilet.
If the toilet was in use, a red light on a shield would indicate it is occupied.
Else a green light indicates it is free.
*describe project purpose*
Next, a display has been added to show the time spent in the water room.
This would put some pressure on the user to not spend too much time on the loo and hold up the queue.
technology
----------
*described electronic details*
Finally, it has been connected to the speakers.
A welcome message would greed the new comer, followed by a pleasant music.
After three minutes, a comical message would encourage the slow rider to hurry up.
board
=====
The current implementation uses a [core board](https://wiki.cuvoodoo.info/doku.php?id=stm32f1xx#core_board).
The devices is comprised by following components:
The underlying template also supports following board:
- [Maple Mini](http://leaflabs.com/docs/hardware/maple-mini.html), based on a STM32F103CBT6
- [System Board](https://wiki.cuvoodoo.info/doku.php?id=stm32f1xx#system_board), based on a STM32F103C8T6
- [blue pill](https://wiki.cuvoodoo.info/doku.php?id=stm32f1xx#blue_pill), based on a STM32F103C8T6
- [black pill](https://wiki.cuvoodoo.info/doku.php?id=stm32f1xx#black_pill), based on a STM32F103C8T6
- [core board](https://wiki.cuvoodoo.info/doku.php?id=stm32f1xx#core_board), based on a STM32F103C8T6
- [ST-LINK V2 mini](https://wiki.cuvoodoo.info/doku.php?id=jtag#mini_st-link_v2), a ST-LINK/V2 clone based on a STM32F101C8T6
- [USB-Blaster](https://wiki.cuvoodoo.info/doku.php?id=jtag#armjishu_usb-blaster), an Altera USB-Blaster clone based on a STM32F101C8T6
**Which board is used is defined in the Makefile**.
This is required to map the user LED and button provided on the board
The ST-LINK V2 mini clone has SWD test points on the board.
Because read protection is enabled, you will first need to remove the protection to be able to flash the firmware.
To remove the read protection (and erase flash), run `rake remove_protection` while a SWD adapter is connected.
The Altera USB-Blaster clone has a pin header for SWD and UART1 on the board.
SWD is disabled in the main firmware, and it has read protection.
To be able to flash using SWD (or the serial port), the BOOT0 pin must be set to 1 to boot the system memory install of the flash memory.
To set BOOT0 to 1, apply 3.3 V on R11, between the resistor and the reference designator, when powering the device.
The red LED should stay off while the green LED is on.
Now you can remove the read protection (and erase flash), run `rake remove_protection` while a SWD adapter is connected.
- a [blue pill](https://wiki.cuvoodoo.info/doku.php?id=stm32f1xx#blue_pill) development board, based on a STM32F103C8T6 micro-controller
- a GW1584 step down voltage converter module to lower the 12V input to 5V for all peripherals
- a switch to cut the power, allowing other devices to connect to the Bluetooth speakers
- a micro-switch in the door lock detects when a user closed the door to use the toilet in peace
- a SK6812 RGBW LED strip illuminates the shield to indicate if the toilet is free or occupied
- a Titan TM1637 4-digit 7-segment display shows the time is second passed since the door has been locked
- a Catalex YX5300 MP3 player reads the songs and announcements from a micro-SD card and outputs it to a 3.5 mm stereo jack
- a Taotronics TT-BA01 Bluetooth transmitter with input 3.5 mm stereo jack connects to the room speaker to send the audio
connections
===========
Connect the peripherals the following way (STM32F10X signal; STM32F10X pin; peripheral pin; peripheral signal; comment):
GW1584 step down voltage converter module:
- *list board to peripheral pin connections*
- IN-: outer shell of 5.5/2.1 barrel connector
- IN+: inner pin of 5.5/2.1 barrel connector, after power switch (6-12V)
- OUT-: ground
- OUT+: 5V
All pins are configured using `define`s in the corresponding source code.
micro-switch in door lock:
- COM: ground
- NO: PB8, use external pull-up resistor (10k to 5V)
SK6812 RGBW LED strip:
- 5V (green cable): 5V
- DIN (yellow cable): PB15 (SPI2_MOSI), through voltage shifter (to get clean 5V signal)
- GND (orange cable): GND
Titan TM1637 4-digit 7-segment display:
- GND: GND
- VCC: 5V
- DIO: PB7
- CLK: PB6
Catalex YX5300 MP3 player:
- GND: GND
- VCC: 5V
- TX: PA3 (UART2_RX)
- RX: PA2 (UART2_TX)
Taotronics TT-BA01:
- 3.5 mm stereo jack: to MP3 player
- cable soldered to button: PA0 (this allows to switch on/off the transmitter, and put it into pairing mode)
- cable soldered to blue: PA1 (this allow to know in which state the transmitter is)
code
====
@ -90,9 +99,9 @@ The `bootloader` is started first and immediately jumps to the `application` if
The `application` image is the main application and is implemented in `application.c`.
It is up to the application to advertise USB DFU support (i.e. as does the provided USB CDC ACM example).
The `bootlaoder` image will be flashed using SWD (Serial Wire Debug).
The `bootloader` image will be flashed using SWD (Serial Wire Debug).
For that you need an SWD adapter.
The `Makefile` uses a Black Magic Probe (per default), or a ST-Link V2 along OpenOCD software.
The `Makefile` uses a ST-Link V2 along OpenOCD software.
To flash the `booltoader` using SWD run `rake flash_booloader`.
Once the `bootloader` is flashed it is possible to flash the `application` over USB using the DFU protocol by running `rake flash`.