stm32f1/README.md

371 lines
9.9 KiB
Markdown
Raw Normal View History

2020-12-10 20:08:52 +01:00
This is the firmware for the ThermoHybaid MBS 0.2G MBLK001 issue 2 (short HBMBSG02) thermo-cycler replacement controller board.
This is the firmware for the thermo-cycler
2017-04-15 13:58:39 +02:00
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).
project
=======
summary
-------
2020-12-10 20:08:52 +01:00
I bought a HBMBSG02 thermo-cycler, with unknown defect, and wanted to use to make PCR tests.
technology
----------
2020-12-10 20:08:52 +01:00
I replaced the controller board with custom electronics to be able to operate it again.
2016-01-29 12:12:04 +01:00
2020-12-10 20:08:52 +01:00
HBMBSG02
========
2016-01-29 12:12:04 +01:00
2020-12-10 20:08:52 +01:00
The device did power up.
After a couple of seconds it shut down the fan and probably waits for further instructions.
No defect was visible.
I did not get any software to operate it, or check for errors.
This is a rather old device, from 2003.
The manufacturer did not reply to my request for any software or further documentation.
2016-01-29 12:12:04 +01:00
2020-12-10 20:08:52 +01:00
There are two RJ11 ports, for RS-485 communication.
No traffic has been seen during boot up (this probably uses a master slave protocol since the devices can be chained).
I did not get any reply after sending random bytes.
The device is made out of the following parts.
MBLK002
-------
The heating (and cooling) bed for 8x12 PCR tubes.
Made of black anodized aluminium.
lid
---
there is a heated lid with two connectors.
temperature sensor, 12 kOhm NTC thermistor, 3-pin (pin 1 has notch):
1. thermistor lead 1
2. thermistor lead 2
3. chassis
connected to MBLK005.
heating element, 150 Ohm resistor, 2-pin connector.
connected to MBLK078.
this is power by AC 220V, controller by main board.
I don't recommend to have is on at full power for too long.
The heating mat gets hot very fast.
I even blew to inline fuse (196 °C) although I only tried to heat it up to 94 °C.
I replaced the fuse.
MBLK005
-------
this board provides power to the controller board and lid.
power + heater, 2x2 connector:
1. red, 12V (13-77 V)
2. black, ground
3. yellow/red, optocoupler anode for triac controlling the lid heater
4. yellow/black, optocoupler cathode for triac controlling the lid heater
2016-01-29 12:12:04 +01:00
2020-12-10 20:08:52 +01:00
1x2 connector to lid heater, controller by BTA06 triac.
2016-01-29 12:12:04 +01:00
2020-12-10 20:08:52 +01:00
it also allows to select between 110 V and 220 V, and provides AC power to the TEC power supply.
MBLK041
-------
RS485 adapter board.
it provides 2 interconnected RJ11 ports.
this allows to chain thermocyclers.
1x4 connector, to main board:
1. yellow, RS-485-2 A (9/Y on MAX489)
2. green, RS-485-2 B (10/Z on MAX489)
3. brown, RS-485-1 A (12/A on MAX489)
4. orange, RS-485-1 B (11/B on MAX489)
A4-246
------
power supply for the TECs (e.g. peltier elements) though yellow/orange cables.
I think this provides a programmable constant current to operate the TECs efficiently.
2x5 IDC connector to main board:
1. IC2 anode
2. IC2 cathode with R23
3. IC4 anode through R24
4. IC4 anode
5. IC6 collector
6. IC6 emitter
7. IC3 anode
8. IC3 cathode through R15
9. IC5 anode through R25
10. IC5 cathode
by applying any combination on ID2-5 I was not able to have it output power.
IC6 is active when IC5 gets power, but that's the only reaction I got.
test points:
- T3-8 -- TP9 -- TR4 -- TP8
- TP8: 38 kHz @ 1V
- TP9: 38 kHz @ 60V
- TP10: ground
- TP11: PWM 38 kHz @ 13V
- TP12: 6V
- TP13: 16.6V
A4-250
------
H-bridge module mounted on A4-246
PL2 connection:
1. ground
2. orange wire (H-bridge output)
3. yellow wire (H-bridge output)
4. VCC (6V)
PL5:
5. IC3 collector
7. VCC
8. ground
9. ground
10. IC6 anode
12. IC5 collector
13. IC2 emitter (pulled down)
14. IC4 emmiter (pulled down)
front panel
-----------
1x5 connector, to main board:
1. ground
2. play/pause indicator, green LED anode
3. play/pause indicator, orange LED anode
4. power indicator, red LED
5. play/pause button, connected to ground when pressed
fan
---
1x2 connector, to main board:
1. red: 12V
2. black: ground
MBLK019/MBLK020
---------------
controls which TECs get power, and how.
2x3 pin plug (IDC numbering):
1. red, VCC
2. red/green, sink to control IC/TR 2/6
3. red/black, sink to control IC/TR 1/4
4. red/blue, connected to pin 6
5. red/brown, sink to control IC/TR 3/5
6. black, connected to pin 4
2016-01-29 12:12:04 +01:00
2020-12-10 20:08:52 +01:00
1x6 conenctor, to TEC and power supply.
2020-01-03 19:40:31 +01:00
2020-12-10 20:08:52 +01:00
MBLK009
-------
2020-01-03 19:41:39 +01:00
ST 339 is a quad voltage comparator.
I don't know what it compares.
LN 393 is a dual comparator.
I don't know what it compares.
there is also an external reference (REF1).
this is probably for the MAX1247 (only the MAX1246 has an internal voltage reference).
MAX1247 is a 4-channel 12-bit ADC.
it is used to measure the temperatures.
there are four 2.2 kOhm thermistors.
one side is connected to REF1, the other to a MAX1247 channel.
- TH4: on the sink, connected to CH2 through R8 (2702), and COM through R4
- TH3: in the tube, connected to CH3 through R7 (2702), and COM through R3
- in the top of the tub heating bed, connected to CH0
- in the bottom of the tub heating bed, connected to CH1
2020-12-10 20:08:52 +01:00
2x7 IDC connector:
01. NC
02. VCC
03. LN393 OUTPUT-A
04. MAX1247 DIN
05. MAX1247 DOUT
06. MAX1247 SCLK
07. MAX1247 nCS
08. ST339 OUTPUT-3
09. LK1 jumper (missing), other side connected to ground
10. LK2 jumper (missing), other side connected to ground
11. LK3 jumper (present), other side connected to ground
12. LK4 jumper (present), other side connected to ground
13. ground
14. LN393 OUTPUT-A through 10 kOhm resistor (not sure what this is used for, probably not just to pull)
2020-12-10 20:08:52 +01:00
1x6 conenctor to TECs:
- 1 -- free standing 93 °C fuse -- fuse in heat sink -- 2x top TECs in series -- 2
- 2 -- 2x middle-top TECs in series -- 3
- 4 -- 2x middle-bottom TECs in series -- 5
- 5 -- 2x bottom TECs in series -- 6
2020-12-10 20:08:52 +01:00
when 3 is + and 1 is -, the top half bed heats up.
when 6 is + and 4 is -, the bottom half bed heats up.
2020-12-10 20:08:52 +01:00
MBLK005
-------
2020-12-10 20:08:52 +01:00
this is the main controller board.
it is connected to all other parts through individual connectors, or the card edge connector.
2020-12-10 20:08:52 +01:00
the 2.4V rechargeable battery was empty and leaking, with spades corroded.
changing the battery did not change anything: the thermo-cycle goes to sleep after power up.
I don't know it it hold the calibration data in SRAM and the reason why the device has been sold as defective.
2020-12-10 20:08:52 +01:00
This is replaced by a custom controller board for which this firmware is.
board
=====
The MBLK005-replacement board uses a [blue pill](https://wiki.cuvoodoo.info/doku.php?id=stm32f1xx#blue_pill), based on a STM32F103C8T6.
peripherals
===========
additional peripherals to operate the thermo cycler:
SSD1306 OLED screen to show the detailed state:
1. GND
2. VDD
3. SCK
4. SDA
2020-12-10 20:08:52 +01:00
24V 12A power supply replacing the A4-246.
ideally it would be an adjustable constant current supply (probably what the original power supply was), but using PWM on constant voltage is good enough for thermocouples, even if less efficient.
2020-12-10 20:08:52 +01:00
12V is not enough to heat the TECs rapidly up to 94 °C.
connections
===========
2016-01-29 12:12:04 +01:00
All pins are configured using `define`s in the corresponding source code.
Connect the peripherals the following way.
heating block MBLK-008 CO IDC 7x2:
01. NC
02. 3.3V
03. PB3
04. PB15 SPI2_MOSI
05. PB14 SPI2_MISO
06. PB13 SPI2_SCK
07. PB12 SPI2_NSS
08. PB4
09. PB5
10. PC14
11. PC15
12. PB1
13. ground
2016-01-29 12:12:04 +01:00
heated lid, 12 kOhm NTC thermistor, 3-pin (pin 1 has notch):
1. PA0/ADC1_CH0, pulled up to 5.0V by 10 kOhm resistor
2. ground
3. earth
thermocouple controller board, MBLK019, 2x3 IDC connector:
1. 3.3 V
2. PA1
3. PA2
4. PA3
5. PA4
6. ground
front panel:
1. ground
2. PA5, with 330 Ohm inline resistor
3. PA6, with 330 Ohm inline resistor
4. PA7, with 330 Ohm inline resistor
5. PB0
fan:
1. 12V front board power supply
2. power nMOS drain
power nMOS source. ground
power nMOS gate. PA15, pulled up externally to 5V
MBLK-078, power + heater, 2x2 connector:
1. LM7805 in
2. ground
3. 5V though 330 Ohm
4. PA10
SSD1306 OLED screen:
1. ground
2. 3.3 V
3. PB6/I2C1_SCL, pulled up to 3.3V by external 10 kOhm resistor
4. PB7/I2C1_SDA, pulled up to 3.3V by external 10 kOhm resistor
thermocouple power supply control board. IDC 2x5:
- 1,2: 5V
- 3,4: PB10
- 5,6: PB11
- 7,8: PB9
- 9,10: ground
2016-01-29 12:12:04 +01:00
2020-12-10 20:08:52 +01:00
DS18B20 1-Wire temperature sensor, 1x3:
1. OWD, PB8
2. ground
3. 3.3V
code
====
2016-01-29 12:12:04 +01:00
dependencies
------------
2016-01-29 12:12:04 +01:00
The source code uses the [libopencm3](http://libopencm3.org/) library.
The projects is already a git submodules.
2017-08-07 23:13:30 +02:00
It will be initialized when compiling the firmware.
Alternatively you can run once: `git submodule init` and `git submodule update`.
2016-01-29 12:12:04 +01:00
firmware
--------
2016-01-29 12:12:04 +01:00
2017-08-07 23:13:30 +02:00
To compile the firmware run `rake`.
2016-01-29 12:12:04 +01:00
documentation
-------------
2017-08-07 23:13:30 +02:00
To generate doxygen documentation run `rake doc`.
2016-01-29 12:12:04 +01:00
flash
-----
2017-04-15 13:58:39 +02:00
There are two firmware images: `bootloader` and `application`.
The `bootloader` image allows to flash the `application` over USB using the DFU protocol.
The `bootloader` is started first and immediately jumps to the `application` if it is valid and the DFU mode is not forced (i.e. by pressing the user button on the board or requesting a DFU detach in the `application`).
2017-08-07 23:13:30 +02:00
The `application` image is the main application and is implemented in `application.c`.
2017-04-15 13:58:39 +02:00
It is up to the application to advertise USB DFU support (i.e. as does the provided USB CDC ACM example).
2020-10-11 12:55:04 +02:00
The `bootloader` image will be flashed using SWD (Serial Wire Debug).
For that you need an SWD adapter.
2020-10-11 12:55:04 +02:00
The `Makefile` uses a ST-Link V2 programmer along OpenOCD software (default), or Black Magic Probe.
2017-08-07 23:13:30 +02:00
To flash the `booltoader` using SWD run `rake flash_booloader`.
2020-10-11 12:55:04 +02:00
If the development board uses the CKS32 chip STM32 alternative, use `CPUTAPID=0x2ba01477 rake flash_booloader`.
2017-04-15 13:58:39 +02:00
2017-08-07 23:13:30 +02:00
Once the `bootloader` is flashed it is possible to flash the `application` over USB using the DFU protocol by running `rake flash`.
2017-04-15 13:58:39 +02:00
To force the bootloader to start the DFU mode press the user button or short a pin, depending on the board.
2017-08-07 23:13:30 +02:00
It is also possible to flash the `application` image using SWD by running `rake flash_application`.
2016-01-29 12:12:04 +01:00
debug
2016-01-29 12:12:04 +01:00
-----
SWD also allows to debug the code running on the micro-controller using GDB.
2017-08-07 23:13:30 +02:00
To start the debugging session run `rake debug`.
2016-01-29 12:12:04 +01:00
USB
---
The firmware offers serial communication over USART1 and USB (using the CDC ACM device class).