Skip to content

Commit

Permalink
Manual update
Browse files Browse the repository at this point in the history
  • Loading branch information
pmnxis committed Oct 8, 2023
1 parent 516f2a1 commit a1b7ea9
Show file tree
Hide file tree
Showing 11 changed files with 223 additions and 71 deletions.
40 changes: 14 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,34 +24,36 @@ This project began development at the request of **GPARK Co., Ltd**<sup>[4](#foo
The project has been granted an open source disclosure except of NDA era.

## Target Hardware
Based on BillMock-HW 0.3 and 0.4. <br/>
0.2 HW bring-up codes are still left for recyle the old PCB.
Based on BillMock-HW 0.4 mini and 0.4. <br/>
0.2 and 0.3 HW bring-up codes are still left for recyle the old PCB.
- 0.2 HW has different gpio configuration compare to latest boards.
- 0.3 HW has minor bugs, floating on VendSide-Inhibit and missing net route on VendSide-1P-StartJam.
- 0.4 HW fixed 0.3 HW bugs.
- 0.4 HW mini reduced BOM for mass-manufacturing

If need to use old 0.2 HW, run `cargo build --features hw_0v2 --no-default-features`.

### Target hardware image
![Actual BillMock PCB 0v3](https://billmock.gpark.biz/images/BillMockPCB_0v3.jpg)
![Actual BillMock PCB 0v3](https://billmock.gpark.biz/images/BillMockPCB_0v4.jpg)

### Hardware design
BillMock hardware schematic repository (only pdf)
https://github.com/pmnxis/BillMock-HW-RELEASE

The schematic printed in PDF is distributed under CC BY-SA 3.0, but the actual Gerber files and project files are private.

#### v 0.2 (2023-06-13)
[BillMock-HW-0v2.pdf](https://github.com/pmnxis/BillMock-HW-RELEASE/blob/master/sch/BillMock-HW-0v2.pdf)

#### v 0.3 (2023-08-11)
[BillMock-HW-0v3.pdf](https://github.com/pmnxis/BillMock-HW-RELEASE/blob/master/sch/BillMock-HW-0v3.pdf)
#### v 0.4 Mini (2023-09-12 or 2023-09-13)
[BillMock-Mini-HW-0v4.pdf](https://github.com/pmnxis/BillMock-HW-RELEASE/blob/master/sch//BillMock-Mini-HW-0v4.pdf)

#### v 0.4 (2023-09-08)
[BillMock-HW-0v4.pdf](https://github.com/pmnxis/BillMock-HW-RELEASE/blob/master/sch/BillMock-HW-0v4.pdf)

#### v 0.4 Mini (2023-09-12 or 2023-09-13)
[BillMock-Mini-HW-0v4.pdf](https://github.com/pmnxis/BillMock-HW-RELEASE/blob/master/sch//BillMock-Mini-HW-0v4.pdf)
#### ~~v 0.3 (2023-08-11)~~ - DEPRECATED
~~[BillMock-HW-0v3.pdf](https://github.com/pmnxis/BillMock-HW-RELEASE/blob/master/sch/BillMock-HW-0v3.pdf)~~

#### ~~v 0.2 (2023-06-13)~~ - DEPRECATED
~~[BillMock-HW-0v2.pdf](https://github.com/pmnxis/BillMock-HW-RELEASE/blob/master/sch/BillMock-HW-0v2.pdf)~~


## Feature diagram
![BillMock feature diagram](https://billmock.gpark.biz/images/billmock_logic_diagram.png)
Expand All @@ -60,22 +62,8 @@ The schematic printed in PDF is distributed under CC BY-SA 3.0, but the actual G
See details here [dependencies](docs/dependencies.md)

### NDA Dependencies
To build with NDA features (GPARK Limited or own secret dependency), need adding following command on each `cargo` command.
build, run or any other `cargo` command.

```sh
# dependency injection from git repository
# CAUTION , this should be work but not working
--config "patch.'https://github.com/pmnxis/billmock-app-rs.git'.serial-arcade-pay-impl.git = \"https://github.com/user_name/repo_name.git\""

# dependency injection from local repository
# this works
--config "patch.'https://github.com/pmnxis/billmock-app-rs.git'.serial-arcade-pay-impl.path = \"../repo_name\""
```

In this repository, experimentally utilize dependency injection that the 'patch' function of 'cargo' to coexist both NDA code and open source example code.

Detail stories [serial-device-limitation](docs/SerialDevice.md)
- [Dependency Injection for card reader](https://billmock.pmnxis.net/dev/dependency_injection.html)
- [Detail stories](docs/SerialDevice.md)

## License
This program and the accompanying materials are made available under the terms
Expand Down
7 changes: 6 additions & 1 deletion book/src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,9 @@ SPDX-License-Identifier: MIT OR Apache-2.0
- [BillMock (Square)](./port_04_overview.md)
- [Vend side (Top)](./port_vend_side.md)
- [Host Side (Bottom)](./port_host_side.md)
- [Miscellaneous](./port_etc.md)
- [Miscellaneous](./port_etc.md)
- [Developer Manual 🛠️⚠️](./dev_manual.md)
- [Software 👨🏽‍💻](./dev/software.md)
- [Develop Environment](./dev/develop_environment.md)
- [Dependency Injection](./dev/dependency_injection.md)
- [Hardware 🔩](./dev/hardware.md)
21 changes: 21 additions & 0 deletions book/src/dev/dependency_injection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!--
SPDX-FileCopyrightText: © 2023 Jinwoo Park ([email protected])
SPDX-License-Identifier: MIT OR Apache-2.0
-->

# Dependency Injection for card reader
To build with NDA features (GPARK Limited or own secret dependency), need adding following command on each `cargo` command.
build, run or any other `cargo` command.

```sh
# dependency injection from git repository
# CAUTION , this should be work but not working
--config "patch.'https://github.com/pmnxis/billmock-app-rs.git'.serial-arcade-pay-impl.git = \"https://github.com/user_name/repo_name.git\""

# dependency injection from local repository
# this works
--config "patch.'https://github.com/pmnxis/billmock-app-rs.git'.serial-arcade-pay-impl.path = \"../repo_name\""
```

In this repository, experimentally utilize dependency injection that the 'patch' function of 'cargo' to coexist both NDA code and open source example code.
108 changes: 108 additions & 0 deletions book/src/dev/develop_environment.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<!--
SPDX-FileCopyrightText: © 2023 Jinwoo Park ([email protected])
SPDX-License-Identifier: MIT OR Apache-2.0
-->

# Develop Environment

_※ It might available with Windows, but in this document only consider Debian-Linux._

### apply USB (stlink-v2/3) permission rule to ignore root access
```sh
# refer https://calinradoni.github.io/pages/200616-non-root-access-usb.html
sudo tee /etc/udev/rules.d/70-st-link.rules > /dev/null <<'EOF'
# ST-LINK V2
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3748", GROUP="plugdev", MODE="660", TAG+="uaccess", SYMLINK+="stlinkv2_%n"
# ST-LINK V2.1
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374b", GROUP="plugdev", MODE="660", TAG+="uaccess", SYMLINK+="stlinkv2-1_%n"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3752", GROUP="plugdev", MODE="660", TAG+="uaccess", SYMLINK+="stlinkv2-1_%n"
# ST-LINK V3
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374d", GROUP="plugdev", MODE="660", TAG+="uaccess", SYMLINK+="stlinkv3loader_%n"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374e", GROUP="plugdev", MODE="660", TAG+="uaccess", SYMLINK+="stlinkv3_%n"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="374f", GROUP="plugdev", MODE="660", TAG+="uaccess", SYMLINK+="stlinkv3_%n"
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0483", ATTRS{idProduct}=="3753", GROUP="plugdev", MODE="660", TAG+="uaccess", SYMLINK+="stlinkv3_%n"
EOF
```

### apply rules and reboot linux
```sh
sudo usermod -a -G plugdev $USER
sudo udevadm control --reload-rules
sudo udevadm trigger
sudo reboot
```

### Necessary apt package for rust embedded
```sh
# necessary for basic software development environment
sudo apt install curl git build-essential -y
# build.rs uses libgit2-sys to get commit hash
sudo apt install pkg-config libssl-dev -y
# for knurling-rs/probe-run
sudo apt install libusb-1.0-0-dev libudev-dev -y

# Install rustc/rustup/cargo for rust development environment
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# Install probe-run for debug/flash firmware binary on target board.
cargo install probe-run

# Install cargo-binutils for analyze mem/flash usage.
cargo install cargo-binutils
rustup component add llvm-tools-preview
```

### Build
```sh
cargo build
```

```sh
pmnxis@lmabdaDeb  ~/Develop/billmock-app-rs   master  cargo build
info: syncing channel updates for 'nightly-2023-08-24-x86_64-unknown-linux-gnu'
info: latest update on 2023-08-24, rust version 1.74.0-nightly (249595b75 2023-08-23)
info: downloading component 'cargo'
info: downloading component 'clippy'
info: downloading component 'llvm-tools'
info: downloading component 'rust-docs'
info: downloading component 'rust-src'
info: downloading component 'rust-std' for 'thumbv6m-none-eabi'
info: downloading component 'rust-std'
info: downloading component 'rustc'
info: downloading component 'rustfmt'
info: installing component 'cargo'
info: installing component 'clippy'
info: installing component 'llvm-tools'
info: installing component 'rust-docs'
info: installing component 'rust-src'
info: installing component 'rust-std' for 'thumbv6m-none-eabi'
info: installing component 'rust-std'
info: installing component 'rustc'
info: installing component 'rustfmt'
Updating crates.io index
Updating git repository `https://github.com/embassy-rs/embassy.git`
```

### Cargo Run
```sh
pmnxis@lmabdaDeb  ~/Develop/billmock-app-rs   master  cargo run
Finished dev [optimized + debuginfo] target(s) in 0.06s
Running `probe-run --chip STM32G030C8Tx --log-format '{t} [{L}][ {f}:{l} ] {s}' target/thumbv6m-none-eabi/debug/billmock-app-rs`
(HOST) INFO flashing program (45 pages / 45.00 KiB)
(HOST) INFO success!
────────────────────────────────────────────────────────────────────────────────
0.000000 [DEBUG][ fmt.rs:130 ] rcc: Clocks { sys: Hertz(16000000), apb1: Hertz(16000000), apb1_tim: Hertz(16000000), ahb1: Hertz(16000000) }
+-----------------------------------------------------------+
Firmware Ver : billmock-app-rs 0.1.2
Git Hash : bf976acd38633f7204e9423def8b5b062e0a0ad3
Git Datetime : 2023-09-17 20:55:10 +0900 | bf976ac
+-----------------------------------------------------------+
0.004272 [TRACE][ fmt.rs:117 ] USART: presc=1, div=0x0000008b (mantissa = 8, fraction = 11)
0.004638 [TRACE][ fmt.rs:117 ] Using 16 bit oversampling, desired baudrate: 115200, actual baudrate: 115107
1.006286 [WARN ][ serial_device.rs:156 ] The module use a example library. It may not work in real fields.
OUT[ LED2-Indicator] : Low
OUT[ LED1-Indicator] : Low
```
44 changes: 44 additions & 0 deletions book/src/dev/hardware.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<!--
SPDX-FileCopyrightText: © 2023 Jinwoo Park ([email protected])
SPDX-License-Identifier: MIT OR Apache-2.0
-->

# Hardware

![Actual BillMock PCB 0v4](https://billmock.gpark.biz/images/BillMockPCB_0v4.jpg)

There are currently four hardware revisions available: 0.2, 0.3, 0.4, and 0.4 Mini. Development is being carried out specifically for the 0.4 and 0.4 Mini revisions, which are the ones that are actually usable.

To check pin mappings or installation details, please refer to the desired section in the table of contents on the left.

For detailed hardware schematics, you can refer to [BillMock-HW-RELEASE](https://github.com/pmnxis/BillMock-HW-RELEASE).

## Hardware design
BillMock hardware schematic repository (only pdf) : [BillMock Hardware PDF Release](https://github.com/pmnxis/BillMock-HW-RELEASE)

The schematic printed in PDF is distributed under CC BY-SA 3.0, but the actual Gerber files and project files are private.

#### v 0.4 Mini (2023-09-12 or 2023-09-13)
[BillMock-Mini-HW-0v4.pdf](https://github.com/pmnxis/BillMock-HW-RELEASE/blob/master/sch//BillMock-Mini-HW-0v4.pdf)

#### v 0.4 (2023-09-08)
[BillMock-HW-0v4.pdf](https://github.com/pmnxis/BillMock-HW-RELEASE/blob/master/sch/BillMock-HW-0v4.pdf)

#### ~~v 0.3 (2023-08-11)~~ - DEPRECATED
~~[BillMock-HW-0v3.pdf](https://github.com/pmnxis/BillMock-HW-RELEASE/blob/master/sch/BillMock-HW-0v3.pdf)~~

#### ~~v 0.2 (2023-06-13)~~ - DEPRECATED
~~[BillMock-HW-0v2.pdf](https://github.com/pmnxis/BillMock-HW-RELEASE/blob/master/sch/BillMock-HW-0v2.pdf)~~

# Hardware License Information

The original data for the circuit diagram is under a private license, but the PDF schematic is distributed under the CC-BY-SA 3.0 license. Therefore, data such as gerbers and the Bill of Materials (BOM) used in production will not be disclosed at all. Additionally, circuits created based on this schematic (PDF) must adhere to the following conditions:

Please provide proper attribution when using it for commercial purposes.

- Attribution: You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

- ShareAlike: If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.

Translation Note: This text appears to describe the licensing terms and conditions related to the hardware, particularly regarding the use of schematic data.
10 changes: 10 additions & 0 deletions book/src/dev/software.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!--
SPDX-FileCopyrightText: © 2023 Jinwoo Park ([email protected])
SPDX-License-Identifier: MIT OR Apache-2.0
-->

# Software

## Card Terminal Connectivity in actual environment
The firmware being developed is based on KICC's ED-785 terminal for mass production. However, in accordance with the NDA agreement, the code related to this is not present in the public codebase. Instead, it is managed separately through dependency injection. Therefore, the publicly available source code contains only example protocol code that does not actually perform any real operations.
15 changes: 15 additions & 0 deletions book/src/dev_manual.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!--
SPDX-FileCopyrightText: © 2023 Jinwoo Park ([email protected])
SPDX-License-Identifier: MIT OR Apache-2.0
-->

# 개발자 매뉴얼

# Write In Rust
Used rust experimentally.

This repository is aiming three goal.
One for development of production firmware and second is making a proof of concept that rust embedded is usable for actual embedded production. And last goal is setting some example about production-rust-embedded-code.

The software code is in [billmock-app-rs](https://github.com/pmnxis/billmock-app-rs) , except NDA related code.
43 changes: 0 additions & 43 deletions book/src/hardware.md

This file was deleted.

2 changes: 1 addition & 1 deletion book/src/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ SPDX-License-Identifier: MIT OR Apache-2.0
To configure it for desired settings on-site, "Billmock" allows preconfigured I/O remapping adjustments through DIP switches. In terms of wiring, it is installed between the HOST GAME PCB and the bill acceptor device.

## Hardware
![Actual BillMock PCB 0v3](https://billmock.gpark.biz/images/BillMockPCB_0v3.jpg)
![Actual BillMock PCB 0v3](https://billmock.gpark.biz/images/BillMockPCB_0v4.jpg)
There are currently three hardware revisions available: 0.2, 0.3, and 0.4. The development is focused on compatibility with versions 0.3 and 0.4, which are the ones actively in use. Detailed hardware schematics are here
[BillMock-HW-RELEASE](https://github.com/pmnxis/BillMock-HW-RELEASE)

Expand Down
2 changes: 2 additions & 0 deletions book/src/port_04_mini_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ SPDX-License-Identifier: MIT OR Apache-2.0

# BillMock Mini

![real photo](https://billmock.gpark.biz/images/pcb_0v4_port/BillMockPCB_0v4_mini_rectangle.jpg)

| Front side | Back side |
| ---- | ---- |
| ![top side image](https://billmock.gpark.biz/images/pcb_top_mini_0v4.png) | ![bottom side image](https://billmock.gpark.biz/images/pcb_bot_mini_0v4.png) |
Expand Down
2 changes: 2 additions & 0 deletions book/src/port_04_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ SPDX-License-Identifier: MIT OR Apache-2.0

# BillMock

![real photo](https://billmock.gpark.biz/images/pcb_0v4_port/BillMockPCB_0v4_square.jpg)

| Front side | Back side |
| ---- | ---- |
| ![top side image](https://billmock.gpark.biz/images/pcb_top_0v4.png) | ![bottom side image](https://billmock.gpark.biz/images/pcb_bot_0v4.png) |
Expand Down

0 comments on commit a1b7ea9

Please sign in to comment.