Bläddra i källkod

Wrote a real README

Clara Hobbs 7 år sedan
förälder
incheckning
b372835fc3
2 ändrade filer med 66 tillägg och 4 borttagningar
  1. 64
    2
      README.md
  2. 2
    2
      src/device_policy_manager.c

+ 64
- 2
README.md Visa fil

@@ -1,3 +1,65 @@
1
-# pd-buddy-firmware
1
+# PD Buddy firmware
2 2
 
3
-PD Buddy firmware
3
+This is the firmware for the PD Buddy project.  Currently, this specifically
4
+means the PD Buddy Sink.  The firmware is currently under heavy development,
5
+but is partially functional.
6
+
7
+## Prerequisites
8
+
9
+To compile the firmware, you must first install the [GNU ARM Embedded
10
+Toolchain](https://launchpad.net/gcc-arm-embedded).  Details of its
11
+installation is beyond the scope of this README.  Once the toolchain is
12
+installed, clone this repository with:
13
+
14
+    $ git clone --recursive http://git.clayhobbs.com/clay/pd-buddy-firmware.git
15
+
16
+This will give you a complete copy of the repository, including the ChibiOS
17
+submodule.
18
+
19
+You will also need to install some program to flash the firmware.  The simplest
20
+option is [dfu-util](http://dfu-util.sourceforge.net/), as it requires no extra
21
+hardware.  If you prefer to use SWD, you could also use
22
+[stlink](https://github.com/texane/stlink) or [OpenOCD](http://openocd.org/).
23
+
24
+## Compiling
25
+
26
+With all the dependencies installed, the firmware can be compiled as follows:
27
+
28
+    $ cd pd-buddy-firmware
29
+    $ make
30
+
31
+This compiles the firmware to `build/pd-buddy-firmware.{bin,elf}`.
32
+
33
+## Flashing
34
+
35
+The firmware can be flashed in any number of ways, including but not limited to
36
+the following:
37
+
38
+### dfu-util
39
+
40
+Set the boot mode switch on the PD Buddy Sink to DFU mode and plug it into your
41
+computer.  Flash the firmware with:
42
+
43
+    $ dfu-util -a 0 -s 0x08000000:leave -D build/pd-buddy-firmware.bin
44
+
45
+Don't forget to set the switch back to normal mode after unplugging the device.
46
+
47
+### stlink
48
+
49
+If you have an ST-LINK/V2, you can use it to flash the firmware via SWD as
50
+follows:
51
+
52
+    $ st-flash write build/pd-buddy-firmware.bin 0x8000000
53
+
54
+### OpenOCD
55
+
56
+OpenOCD can also be used to flash the firmware.  For example:
57
+
58
+    $ openocd -f interface/stlink-v2.cfg -f target/stm32f0x.cfg -c "program build/pd-buddy-firmware.bin verify reset exit"
59
+
60
+## Usage
61
+
62
+Currently, there isn't much to say here.  Plug it into your power supply, and
63
+the PD Buddy Sink will negotiate 2.25 A at 20 V.  This can be configured by
64
+editing `dpm_desired_v` and `dpm_desired_i` in `src/device_policy_manager.c`,
65
+then recompiling and reflashing.

+ 2
- 2
src/device_policy_manager.c Visa fil

@@ -28,8 +28,8 @@
28 28
 
29 29
 /* The voltage and current we want */
30 30
 /* XXX In the future, these won't be *quite* so convenient to access */
31
-static uint16_t dpm_desired_v = 400; /* 20 V */
32
-static uint16_t dpm_desired_i = 225; /* 2.25 A */
31
+static uint16_t dpm_desired_v = 400; /* 0.05 V increments */
32
+static uint16_t dpm_desired_i = 225; /* 0.01 A increments */
33 33
 
34 34
 /* Whether or not the power supply is unconstrained */
35 35
 static uint8_t dpm_unconstrained_power;

Laddar…
Avbryt
Spara