forked from thanks4opensource/buck50
-
Notifications
You must be signed in to change notification settings - Fork 1
/
README.html
4043 lines (3473 loc) · 248 KB
/
README.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta charset="utf-8"/>
<meta name="buck50" content="Test and measurement firmware for "Blue Pill" STM32F103"/>
</head>
<body>
<hr />
<p><strong>buck50</strong> is open-source firmware that turns a “Blue Pill” STM32F103 development board (widely available for approx. US$1.50) into a multi-purpose test and measurement instrument, including:</p>
<ul>
<li>8 channel, 6+ MHz logic analyzer
<ul>
<li>Approx. 5K sample buffer depth</li>
<li>Samples stored only at signal edges for efficient memory usage</li>
<li>Units may be ganged for increased number of channels</li>
<li>Complex triggering via user-defined state machine supporting combinations of sequential (“A then B then C”) and logical-OR (“A or B or C”) conditionals</li>
<li>Output to VCD and other file formats for export to waveform viewing software <a href="#footnote_1"><sup>1</sup></a></li>
</ul></li>
<li>Live monitoring and logging of digital, analog, USART (sync/async), SPI (MOSI/MISO), and I2C (master/slave/TX/RX) data</li>
<li>Simple dual-channel approx. 1 MHz digital storage oscilloscope, approx. 5K sample buffer depth (10K if single channel)</li>
<li>3 channel digital pulse train generator with user-defined frequency and per-channel duty cycle and polarity</li>
<li>Bidirectional bridge/converter from USART/UART (async/synchro), SPI (master/slave), or I2C … to USB … to host terminal, UNIX socket, or UNIX pty device file</li>
<li>8-bit parallel output counter (binary or gray code)</li>
<li>Host terminal ascii or binary input data to 8-bit parallel output</li>
<li>Firmware written in a combination of C++ and ARM Thumb-2 assembly code, with several non-standard <a href="#hacks_techniques">hacks^H^H^H^H^Htechniques</a> of possible general interest to advanced software developers</li>
<li>Python host driver program with comprehensive inline help system and usability features</li>
<li>Coffee maker attachment sold separately, not included in base price <a href="#footnote_2"><sup>2</sup></a></li>
</ul>
<h2 id="branamecontentsacontents"><br> <a name="contents"></a>
Contents</h2>
<ul>
<li><a href="#license">License</a></li>
<li><a href="#firmware_installation">Firmware installation</a></li>
<li><a href="#hardware_connections">Hardware connections</a></li>
<li><a href="#buck50_py_driver_program">buck50.py driver program</a>
<ul>
<li><a href="#python">Python</a></li>
<li><a href="#Wheres_the_gui">Where’s the GUI?</a></li>
<li><a href="#TL_DNR">TL;DNR(“Too Long, Did Not Read”)</a></li>
<li><a href="#NLE_WTRSBNTMM">NLE;WTRSBNTMM(“Not Long Enough, Want To Read Some But Not Too Much More”)</a></li>
<li><a href="#OK_TSIGMTW9Y">OK;TSIGMTW9Y(“OK, This Sounds Interesting, Give Me The Whole 9 Yards”)</a>
<ul>
<li><a href="#buck50_py_startup_and_device_connection">buck50.py startup and device connection</a></li>
<li><a href="#review_license">review license</a></li>
<li><a href="#help">help</a></li>
<li><a href="#usage_help">usage help</a></li>
<li><a href="#configure_command"><code>configure</code> command</a></li>
<li><a href="#logic_command"><code>logic</code> command</a></li>
<li><a href="#oscope_command"><code>oscope</code> command</a></li>
<li><a href="#dump_command"><code>dump</code> command</a></li>
<li><a href="#trigger_command"><code>trigger</code> command</a></li>
<li><a href="#monitor_command"><code>monitor</code> command</a></li>
<li><a href="#lines_config"><code>lines</code> configuration</a></li>
<li><a href="#adcN_configs"><code>adcN</code> configurations</a></li>
<li><a href="#numbers_command"><code>numbers</code> command</a>(<a href="#non_intuitive_names">*</a>)</li>
<li><a href="#gpio_command"><code>gpio</code> command</a></li>
<li><a href="#usart_command"><code>usart</code> command</a></li>
<li><a href="#spi_command"><code>spi</code> command</a></li>
<li><a href="#i2c_command"><code>i2c</code> command</a></li>
<li><a href="#ipc_configuration"><code>ipc</code> configuration</a></li>
<li><a href="#pty_configuration"><code>pty</code> configuration</a></li>
<li><a href="#socket_configuration"><code>socket</code> configuration</a></li>
<li><a href="#pulse_command"><code>pulse</code> command</a>(<a href="#non_intuitive_names">*</a>)</li>
<li><a href="#reset_command"><code>reset</code> command</a></li>
</ul></li>
</ul></li>
<li><a href="#waveform_viewing_software">Waveform viewing software</a>
<ul>
<li><a href="#gnuplot">gnuplot</a></li>
<li><a href="#gtkwave">gtkwave</a></li>
<li><a href="#pulseview">PulseView</a></li>
<li><a href="#Logic">Logic</a></li>
</ul></li>
<li><a href="#firmware_design_and_implementation">Firmware design and implementation</a>
<ul>
<li><a href="#port_assignments">Port assignments</a></li>
<li><a href="#hacks_techniques">Hacks^H^H^H^H^Htechniques</a>
<ul>
<li><a href="#infinite_loop">Infinite loop</a></li>
<li><a href="#longjmp_from_interrupt_handler"><code>longjmp</code> from interrupt handler</a></li>
<li><a href="#sparse_timestamped_samples">Sparse timestamped samples</a></li>
</ul></li>
<li><a href="#why_so_slow">Why so slow?</a></li>
</ul></li>
<li><a href="#building_from_source">Building from source</a></li>
<li><a href="#current_version">Current version</a></li>
<li><a href="#future_work">Future work</a></li>
<li><a href="#footnotes">Footnotes</a></li>
</ul>
<h2 id="branamelicensealicense"><br> <a name="license"></a>
License</h2>
<p>buck50: Test and measurement firmware for “Blue Pill” STM32F103 development board</p>
<p>Copyright (C) 2019,2020 Mark R. Rubin aka “thanks4opensource”</p>
<p>This file is part of buck50.</p>
<p>The buck50 program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.</p>
<p>The buck50 program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.</p>
<p>You should have received a copy of the <a href="LICENSE.txt">GNU General Public License</a> along with the buck50 program. If not, see <a href="https://www.gnu.org/licenses/gpl.html">https://www.gnu.org/licenses/gpl.html</a></p>
<h2 id="branamefirmware_installationafirmwareinstallation"><br> <a name="firmware_installation"></a>
Firmware installation</h2>
<p>buck50 is provided as ready-to-flash files in ELF (<a href="build/buck50.elf">buck50.elf</a>), binary (<a href="build/buck50.bin">buck50.bin</a>), and Intel hex (<a href="build/buck50.hex">buck50.hex</a>) formats in addition to source code (see <a href="#building_from_source">Building from source</a>, below).</p>
<p>Instructions on how to flash code onto microcontrollers such as the STM32F103 are beyond the scope of this document. Briefly, the STM32F103 cannot be flashed via its USB port (except <a href="#footnote_3"><sup>3</sup></a>), so other techniques must be employed.</p>
<p>Probably the best method is via the “Blue Pill” SWD port (see <a href="#hardware_connections">Hardware connections</a>, below) using either a Black Magic Probe (<a href="https://1bitsquared.com/products/black-magic-probe">website</a>, <a href="https://github.com/blacksphere/blackmagic/wiki">wiki</a>) or an ST-Link (<a href="https://www.st.com/en/development-tools/st-link-v2.html">website</a>) or clone thereof (<a href="https://www.google.com/search?q=st-link+clone">Google search</a>). Note that the former is used with GDB from the <a href="https://developer.arm.com/tools-and-software/open-source-software/developer-tools/gnu-toolchain/gnu-rm">GNU Arm Embedded Toolchain</a> and the latter either with GDB or <code>stlink</code> (<a href="https://github.com/stlink-org/stlink">GitHub repository</a>) among other software front ends.</p>
<p>Alternately, the “Blue Pill” can be flashed via its USART1 serial port (RX on port PA10, TX on PA9, see <a href="#hardware_connections">below</a>). This typically requires a USB-to-serial converter
(<a href="https://www.google.com/search?&q=usb-to-serial+adapter&oq=usb-to-serial+adapter">Google search</a>) (or, ironically, another already-flashed “buck50” <a href="#footnote_4"><sup>4</sup></a>) as modern host computers rarely include an RS-232 port. Instructions and software required for doing so can be found at the <code>stm32flash</code> SourceForge <a href="https://sourceforge.net/projects/stm32flash/">website</a>, this tutorial <a href="https://maker.pro/arduino/tutorial/how-to-program-the-stm32-blue-pill-with-arduino-ide">web page</a>, and/or a <a href="https://github.com/palhartinger/HowTo-STM32F103C8T6/wiki/6_Programming-with-UART">GitHub wiki</a>, among other resources. If using a serial port method remember to change the BOOT0 jumper (see directly <a href="#hardware_connections">below</a>) back to its “0” position after flashing with it set to “1”.</p>
<h2 id="branamehardware_connectionsahardwareconnections"><br> <a name="hardware_connections"></a>
Hardware connections</h2>
<p>The following is a highly simplified, edited version of the incredibly useful image created by Rasmus Friis Kjeldsen <a href="#footnote_5"><sup>5</sup></a>, available at <a href="http://reblag.dk/stm32/">http://reblag.dk/stm32/</a> (direct link: <a href="http://reblag.dk/wordpress/wp-content/uploads/2016/07/The-Generic-STM32F103-Pinout-Diagram.pdf">http://reblag.dk/wordpress/wp-content/uploads/2016/07/The-Generic-STM32F103-Pinout-Diagram.pdf</a>). The edited and <a href="images/The-Generic-STM32F103-Pinout-Diagram.pdf">original</a> versions are included in this repository under terms in compliance with the original’s <a href="https://creativecommons.org/licenses/by-sa/1.0/">license</a>.</p>
<figure>
<img src="images/buck50_full.png" alt="" title="hardware connections" />
<figcaption></figcaption>
</figure>
<p><strong>WARNING!</strong> Incorrect hookups to the “Blue Pill” (or any other microcontroller’s) ports may cause permanent damage. Examples: Connecting a push-pull output port directly to a positive voltage source or ground sink, or to another push-pull output on the same or different MCU set to the opposite polarity. Readers of this document and users of the firmware it describes assume all responsibility for their actions.</p>
<h4 id="pindescriptions">Pin descriptions</h4>
<p>The buck50 firmware configures and uses the “Blue Pill” STM32F103 GPIO ports as follows. Note that many pins have multiple uses depending on which <code>buck50.py</code> host command is in effect, including changing roles to be either inputs, outputs, or bidirectional.</p>
<pre><code> Pin(s) Type Purpose buck50.py commands
====== ============================== ================================= ==================
PB4-11 input weak pull-down digital input logic, monitor
PB10,11 in/out open-drain I2C i2c, monitor
PA0-7 output push-pull digital output numbers, gpio
PA0-7 input analog analog input oscope, monitor
PA1-3 output push-pull digital pulse outputs pulse
PA0 input weak pull-up usart CTS usart
PA1 output push-pull usart RTS usart
PA2 output push-pull usart TX usart
PA3 input weak pull-up usart RX usart
PA4 output push-pull SPI select output (master) spi, monitor
PA4 input floating SPI select input (slave) spi, monitor
PA5 output push-pull SPI clock (master) spi, monitor
PA5 input floating SPI clock (slave) spi, monitor
PA6 input floating/pull-up/-down SPI MISO spi, monitor
PA7 output push-pull SPI MOSI spi, monitor
PA8 output push-pull USART clock (synchronous) usart, monitor
PA9 output push-pull USART TX usart, monitor
PA10 input weak pullup USART RX usart, monitor
PB13 output push-pull sampling indicator, sync logic, oscope
PB14 output open-drain external/ganged trigger logic, oscope
PB15 output open-drain external/ganged trigger ack logic, oscope
PC13 output open-drain status/fault/sampling/triggering <all>, logic, oscope
PA11 output open-drain USB negative (do not connect) <all>
PA12 output open-drain USB positive (do not connect) <all>
</code></pre>
<p>See <a href="#logic_command">logic</a>, <a href="#monitor_command">monitor</a>, <a href="#numbers_command">numbers</a>, <a href="#spi_command">spi</a>, and <a href="#usart_command">usart</a>, below.</p>
<h5 id="notes:">Notes:</h5>
<ul>
<li>See <a href="#buck50_py_driver_program">buck50.py driver program</a>, below, for command usage.</li>
<li>PA0–7 are multipurpose pins, as per above.</li>
<li>PC13 connected to on-board user LED
<ul>
<li>On: Firmware running and connected to USB</li>
<li>Off: Triggering and/or sampling</li>
<li>Blinking 2 Hz: <code>reset blink</code> command (used to identify physical device)</li>
<li>Blinking 4 Hz: Firmware error (requires hardware reboot and host software reconnect <a href="#footnote_6"><sup>6</sup></a>).</li>
</ul></li>
<li>PB13 outputs approx. 2.15 Hz 50% duty cycle square wave during digital sampling. Can be connected to an external LED (with appropriate current-limiting resistor) or other external monitoring as sampling indicator, and/or connected to ganged buck50s as additional sync signal for post-processing alignment of captured data.</li>
<li>PB14 and PB15 can be used to synchronize triggering across multiple buck50 “Blue Pill”s. Connect all PB14 pins to an open-drain bus line (with pull-up resistor), and similarly for PB15. See <code>buck50.py</code>’s <code>help reset ganged=</code>, <code>help reset ext-trig</code>, and <code>help trigger</code>, and <a href="#logic_command">logic command</a> and <a href="#reset_command">reset command</a>, below.</li>
</ul>
<h2 id="branamebuck50_py_driver_programabuck50.pydriverprogram"><br> <a name="buck50_py_driver_program"></a>
buck50.py driver program</h2>
<p><a name="python"></a></p>
<h3 id="python">Python</h3>
<p><a href="build/buck50.py">buck50.py</a> is (obviously) written in Python. Python3 (<a href="#footnote_7"><sup>7</sup></a>) (3.6 to be precise). It was developed under Linux and should be portable any Linux distribution or other UNIX-like operating system. External library and file system assumptions (<code>/dev/ttyACMn</code>, <code>/dev/pts/NN</code>) may require modification for use under macOS. It is unlikely that <code>buck50.py</code> will function in a Microsoft Windows® environment without fairly extensive code modifications.</p>
<p><br><a name="Wheres_the_gui"></a></p>
<h3 id="wheresthegui">Where’s the GUI?</h3>
<p>(Note to the impatient: If reading sequentially, skip ahead to <a href="#TL_DNR">TL;DNR (“Too Long, Did Not Read”)</a>, below.)</p>
<p>Good question. The original intent for buck50 was to integrate the host-based driver into an existing open source waveform viewer program. This was abandoned due to limitations in the ones I could find (see <a href="#waveform_viewing_software">Waveform viewing software</a>, below), and also as the scope of buck50 grew beyond it’s original beginnings as a logical analyzer and evolved into the many-headed Hydra it eventually became. (Its capabilities no longer fit into the basic design of a logic analyzer program.)</p>
<p>In addition, many of those capabilities are inherently text based (monitoring, SPI and USART bridges, etc). Sure, any decent GUI library provides a scrolling text widget, but a text-based program inherently leverages the features of the many excellent Linux terminal emulator programs available. As an analogy, consider the difference between the typical on-screen GUI calculator program that mimics a handheld device with only one numeric display line compared to a full featured text-based program like <code>bc</code> (or, for that matter, Python).</p>
<p>The <code>buck50.py</code> interface was expressly written for fast and easy usage in an active test and measurement environment. Think of it as an ugly-looking GUI with many, many “hot key” shortcuts. (Just like the GUI calculators: What’s faster? Typing numbers on a keyboard or mousing around clicking virtual GUI buttons? Also <a href="#footnote_8"><sup>8</sup></a>.) Try <code>buck50.py</code>, and if dissatisfied but still want to use the firmware, feel free to write a GUI driver (respect the <a href="#license">GPL license</a> above). A wrapper layer around the <code>buck50.py</code> module would be fairly easy to implement.</p>
<p><a name="viewer_integration"></a>
All the above notwithstanding, <code>buck50.py</code> does attempt to integrate nicely with external waveform viewing software (see <a href="#waveform_viewing_software">below</a>). If <code>gnuplot</code> is installed on the host system, the code will by default to automatically dump captured digital or analog data to a temporary file and load that (see <a href="#gnuplot">gnuplot</a>, below) with the appropriate commands <a href="#footnote_9"><sup>9</sup></a>. Other viewers may be manually configured/enabled as well.</p>
<p><br> <a name="TL_DNR"></a></p>
<h3 id="tldnrtoolongdidnotread">TL;DNR (“Too Long, Did Not Read”)</h3>
<p>The buck50 firmware and <code>buck50.py</code> driver implement many complex capabilities. The interface is thus necessarily complex but has been designed to allow simple default usage when fine-grained control is not needed.</p>
<h5 id="examples:">Examples:</h5>
<p>Output 4Hz incrementing binary counter on output ports PA0 through PB77:</p>
<pre><code> $1.50: numbers
<ENTER> to halt ...
</code></pre>
<p>Monitor input ports PB4 through PB11:</p>
<pre><code> $1.50: monitor
<ENTER> to end
0.000 00111001 ... ... blu grn yel ... ... brn
0.250 00111010 ... ... blu grn yel ... red ...
0.500 00111011 ... ... blu grn yel ... red brn
0.750 00111100 ... ... blu grn yel org ... ...
1.000 00111101 ... ... blu grn yel org ... brn
1.250 00111110 ... ... blu grn yel org red ...
1.500 00111111 ... ... blu grn yel org red brn
1.750 01000000 ... vio ... ... ... ... ... ...
2.000 01000001 ... vio ... ... ... ... ... brn
2.250 01000010 ... vio ... ... ... ... red ...
2.500 01000011 ... vio ... ... ... ... red brn
2.750 01000100 ... vio ... ... ... org ... ...
3.000 01000101 ... vio ... ... ... org ... brn
3.250 01000110 ... vio ... ... ... org red ...
</code></pre>
<p>Logic analyzer, capture first 32 signal level changes on ports PB4 through PB11:</p>
<pre><code> $1.50: logic edges=32
logic: edges=32
Waiting for sampling finish (<ENTER> to abort) ...
Triggered at state #0: 32 samples (6.26MHz) in 0.00 seconds. Stopped by number of samples.
</code></pre>
<p>The captured sample data will be automatically uploaded and an external viewer program launched if configured (see <a href="#viewer_integration">above</a>). Otherwise (or in addition), data can be manually uploaded and saved, for example:</p>
<pre><code> $1.50: dump digital-frmt=vcd file=capture
logic samples: 0...31 of 32 @ 6.26MHz ... saving to file capture.vcd
</code></pre>
<p>Logic analyzer, as above, but trigger on rising edge of input port PB8</p>
<pre><code> $1.50: trigger 0=xxx0xxxx-1-0 # wait for PB8 low
$1.50: trigger 1=xxx1xxxx-0-1 # wait for PB8 high
$1.50: logic edges=32
logic: edges=32
Waiting for sampling finish (<ENTER> to abort) ...
Triggered at state #1: 32 samples (6.26MHz) in 5.18 seconds. Stopped by number of samples.
logic samples: 0...31 of 32 @ 6.26MHz ... saving to file /tmp/temp.csv
</code></pre>
<p><a name="usart_bridge"></a>
USART bridge:</p>
<pre><code> $1.50: usart
<ENTER> to input, then input ascii text with optional "\n", "\t", and "\x<two hex digits>" escape sequences ...
received data
more received data
-- <ENTER> key pressed here --
"END" to finish: data to send
yet more received data
-- <ENTER> key pressed here --
"END" to finish: END
flushing USB CDC-ACM pipe for 1 second (<ENTER> to abort) ...
</code></pre>
<p>or alternately:</p>
<pre><code> $1.50: usart ipc external pty enable
ipc: external
pty: enable
pty /dev/pts/41 ready
I/O active, press <ENTER> to exit ...
</code></pre>
<p>and then run an external terminal application (<code>screen</code>, <code>miniterm</code>), or more simply:</p>
<pre><code> $ cat /dev/pts/41 & cat > /dev/pts/41
</code></pre>
<p>I2C bridge (slave @ address 31, initialize register 0x5b with 1, register 0x2a with 0x39, then read 6 byte wide register 0x33 twice):</p>
<pre><code> $1.50: i2c master
i2c: master
Input format: <slave address> <rx size> <tx data <2hex|3dec|1ascii>) ...> [; ...]
"0 0" to end: 0x1f 0 5b 01 ; 0x1f 0 2a 39
stat= OK tx=2 rx=0 :
stat= OK tx=2 rx=0 :
"0 0" to end: 0x1f 6 33
stat= OK tx=1 rx=6 : 255-ff-. 215-d7-. 254-fe-. 044-2c-, 003-03-. 208-d0-.
"0 0" to end: 0x1f 6 33
stat= OK tx=1 rx=6 : 255-ff-. 212-d4-. 254-fe-. 043-2b-+ 003-03-. 212-d4-.
"0 0" to end: 0 0
</code></pre>
<p>Continuously read register after above I2C address 31 device initialization:</p>
<pre><code> $1.50: monitor pb4-11=disabled rate=1s i2c master addr=31 tx-data=33 rx-size=6
i2c: master
monitor: pb4-11=disabled
monitor: rate=1Hz=1s
i2c: addr=31
i2c: tx-data=33
i2c: rx-size=6
<ENTER> to end
0.001 i:ff.d9.fe.2e.03.d5
1.002 i:ff.d5.fe.2c.03.d4
2.003 i:ff.d7.fe.2f.03.d5
3.003 i:ff.d1.fe.28.03.cf
4.004 i:ff.d2.fe.31.03.d4
5.005 i:ff.d9.fe.2a.03.dd
6.006 i:ff.d5.fe.2c.03.d9
7.007 i:ff.d2.fe.27.03.d0
8.008 i:ff.cd.fe.2a.03.da
...
</code></pre>
<p>Output 1kHz square waves on port PA1 through PA3, rising edges at 250, 500, and 750 ms respectively in total period:</p>
<pre><code> $1.50: pulse enable
</code></pre>
<p>Capture analog values from inputs PA4 and PA5, triggering on positive slope at 1.65V on channel PA4</p>
<pre><code> $1.50: oscope trgr-chnl=4 scnd-chnl=5 trigger=0:3.3:0.15:0.01
oscope: trgr-chnl=4
oscope: scnd-chnl=5
Waiting for sampling finish (<ENTER> to abort) ...
3257 samples, 2 channels (PA4,PA5) at 239.5+12.5@12MHz->47.6kHz in 3.83s wall clock time. Stopped by number of samples.
Samples 0...3256 (3257 total) 2 channels (PA4,PA5) per sample at 239.5+12.5@12MHz->47.6kHz
</code></pre>
<p><br> <a name="NLE_WTRSBNTMM"></a></p>
<h3 id="nlewtrsbntmm“notlongenoughwanttoreadsomebutnottoomuchmore”">NLE;WTRSBNTMM (“Not Long Enough, Want To Read Some But Not Too Much More”)</h3>
<p>After reading the above, an reasonable reaction might be: <em>You want me to type all those complicated commands? How is that “fast and easy” usage?</em></p>
<p>A valid criticism … but there is hope. That’s why you, the sophisticated user, chose to read this section. ;) Remember all that stuff that got printed when the program started?</p>
<pre><code> buck50.py 0.9.2
Copyright 2020 Mark R. Rubin aka "thanks4opensource"
This is free software with ABSOLUTELY NO WARRANTY.
For details type "warranty" or "help warranty".
Type "using" for program usage.
Type "help" for commands, configurations, parameters, values.
...
</code></pre>
<p>Well, after reading the full license (you did type “warranty” or “help warranty”, didn’t you?), those with inquisitive minds might try:</p>
<pre><code> $1.50: using
Input:
- Type "<command> ..." followed by ENTER key
- Abbreviate any command, configuration, parameter, or value to its unique prefix
Example:
m d=i r=4k a w=2 spe=6
same as:
monitor duration=infinite rate=4kHz adc weight=2 speed=600kHz=1.66667μs
- "#" in line: rest of line ignored
Completion:
key(s) result:
------ -------
<TAB> Completes partially typed command, configuration, parameter,
or value (if unique prefix), else ...
<TAB><TAB> ... sounds terminal bell and second <TAB> prints list
of possible completions
...
</code></pre>
<p>The <code>using</code> help natters on for quite a while (violating this section’s "Not Too Much More” promise) with examples, information on input editing, history, and more. But the two important points are:</p>
<ol>
<li>Abbreviate anything, and/or …</li>
<li>… use <code>TAB</code> key completion.</li>
</ol>
<p>#2 is the “FTW” secret. If you take away nothing else from reading this document, remember:</p>
<ul>
<li>PRESS THE <code>TAB</code> KEY!!! (<a href="#footnote_10"><sup>10</sup></a>)</li>
</ul>
<p>That, along with the the program’s built-in help system, largely make this entire <code>README.md</code> redundant. The help system is hierarchical, starting with general information:</p>
<pre><code> $1.50: help
Help:
Commands, Configurations, Actions, Parameters, Values:
<command> [[<action>] [<parameter>=<value>] ...] [<configuration> [<action>]
[<parameter>=<value>] ...] ... [# comment ...]
Syntax:
symbol explanation
------ -----------
<command> command name
[...] optional
[<action>] optional action name
[<parameter>=<value>] optional parameter=value names
<configuration> configuration name
... optional repeats
[# comment ...] text from "#" to end of line ignored
Verbose explanation:
- Program executes Commands
- Commands use Parameter=Value settings
- Parameter=Value settings are grouped into Configurations
- Configurations may have optional Actions
- Parameters have default Values
- Parameters retain their Values until changed by new Parameter=Value setting,
"configure load", or program exit/restart.
- Commands have a primary Configuration, with same name as the Command
- Commands may have one or more secondary Configurations
- Primary configuration is initial current Configuration
- Configuration remains current until changed by explicit new Configuration
- Only current Configuration's Parameters=Values can be set
- Configurations may be used by multiple Commands
- Only one Action allowed per Configuration per Command
...
</code></pre>
<p>and continuing on with examples and hints on how to dive deeper into the help hierarchy.</p>
<p>Beyond that, experimenting with the commands and their configurations and parameters (and the <code>TAB</code> key!) should suffice to get started. Or continue with reading the next section …</p>
<p><br> <a name="OK_TSIGMTW9Y"></a></p>
<h3 id="oktsigmtw9yokthissoundsinterestinggivemethewhole9yards">OK;TSIGMTW9Y (“OK, This Sounds Interesting, Give Me The Whole 9 Yards”)</h3>
<p>Kudos to those who ended up (or skipped directly to) here. A brief review <a href="#footnote_11"><sup>11</sup></a>, particularly for the latter, of the <code>buck50.py</code> program’s usage features …</p>
<p>First, any input can be fully typed, or abbreviated to its unique prefix. Each of the following sets of lines produces an identical result:</p>
<pre><code> $1.50 h
$1.50 he
$1.50 help
$1.50 m
$1.50 mon
$1.50 monitor
$1.50: n o=p r=1k m=b
$1.50: num op=pu ra=1kh mo=bin
$1.50: numbers open-pull=push-pull rate=1kHz mode=binary
</code></pre>
<p>Note that all commands echo any changed parameters, both as a reminder and more importantly to confirm the expansion of any abbreviations:</p>
<pre><code> $1.50: n o=p r=1k m=b
numbers: open-pull=push-pull
numbers: rate=1kHz=1ms
numbers: mode=binary
$1.50: num op=pu ra=1kh mo=bin
numbers: open-pull=push-pull
numbers: rate=1kHz=1ms
numbers: mode=binary
$1.50: numbers open-pull=push-pull rate=1kHz mode=binary
numbers: open-pull=push-pull
numbers: rate=1kHz=1ms
numbers: mode=binary
</code></pre>
<p><a name="tab_key_redux"></a>
Second, the keyboard <code>TAB</code> key completes any unambiguous partially-typed entry, possibly up a common prefix of multiple valid choices. It sounds the system “bell” otherwise, and when pressed a second time presents a list of valid choices (if any). <code>TAB</code> can be used with blank space to give a full list of valid entries in the current context.</p>
<pre><code> $1.50: s<TAB>
$1.50: spi <TAB><TAB>
ascii-num= endian= mode= pull= snoop= xmit-only=
baud= idle= nss-time= rate= socket
busy-wait= ipc nss= rx-wait= speed=
disable master phase= select= spi
end= miso= pty slave tx-data=
$1.50: spi b<TAB><TAB>
baud= busy-wait=
$1.50: spi ba<TAB>
$1.50: spi baud=
1.125MHz 2.25MHz 36MHz 562.5KHz
18MHz 281.25KHz 4.5MHz 9MHz
$1.50: spi baud=2<TAB><TAB>
2.25MHz 281.25KHz
$1.50: spi baud=28<TAB>
$1.50: spi baud=281.25KHz
</code></pre>
<p>The painstaking example above is more complicated and time-consuming to go through than actually using the <code>TAB</code> key in the <code>buck50.py</code> itself. Just keep pressing <code>TAB</code> and follow the suggestions.</p>
<p>As described in the <a href="#NLE_WTRSBNTMM">previous section</a>, <code>buck50.py</code> features an extensive build-in help system. The following is a (largely depth-first) guided tour through it, with occasional brief additional comments.</p>
<p>First, however, the program needs to be started from a UNIX shell …</p>
<p><a name="buck50_py_startup_and_device_connection"></a></p>
<h4 id="buck50.pystartupanddeviceconnection">buck50.py startup and device connection</h4>
<p>Commandline arguments:</p>
<pre><code> $ ./buck50.py --help
usage: buck50.py [-h] [-v] [-q] [-f [FILE]] [-x]
[--halt {monitor,gpio,usart,spi,i2c,numbers}]
[acm]
positional arguments:
acm CDC/ACM device (with or without "/dev" or "/dev/tty"
prefix) (default: /dev/ttyACM0)
optional arguments:
-h, --help show this help message and exit
-v, --version Print program/protocol version and exit (default:
False)
-q, --quiet Don't print startup info (default: False)
-f [FILE], --file [FILE]
Config file to load at startup (see "help configure
load" (default: None)
-x, --no-auto-viewer Disable automatic, pre-"--file" search for waveform
viewing software and setting of "logic autodump=",
"oscope autodump=", and "dump auto-digital= auto-
analog= viewer-csv= viewer-vcd= digital-frmt= analog-
frmt=" parameters. See "help xxx ..." for those
commands/configurations/parameters. (default: False)
--halt {monitor,gpio,usart,spi,i2c,numbers}
Experimental. Reset firmware if buck50.py exit while
command in progress. Must be done before buck50.py
without "--halt", and must specify correct command
name, else firmware/hardware reset and/or power cycle,
and USB re-enumeration required. (default: none)
</code></pre>
<p>Normal startup:</p>
<pre><code> $ buck50.py
buck50.py 0.9.2
Copyright 2020 Mark R. Rubin aka "thanks4opensource"
This is free software with ABSOLUTELY NO WARRANTY.
For details type "warranty" or "help warranty".
Type "using" for program usage.
Type "help" for commands, configurations, parameters, values.
Connecting to buck50 device (press CTRL-C to abort ... )
Firmware identity match: 0xea017af5
Firmware version match: 0.9.2
Device serial number: 123456789abcdef987654321
Found /usr/bin/pulseview and /usr/bin/gnuplot. Have now set:
configure logic autodump=enabled oscope autodump=enabled dump output=file auto-digital=enabled auto-analog=enabled digital-frmt=csv viewer-csv=gnuplot viewer-vcd=pulseview
</code></pre>
<p>Note that the correct <code>/dev</code> CDC/ACM USB special file corresponding to the STM32F103 “Blue Pill” device running the buck50 firmware must given as a commandline argument if it is not the default <code>/dev/ttyACM0</code>. On Linux systems the default should be correct if no other CDC/ACM USB devices are connected (or the buck50 device was connected first, before the others).</p>
<p>If not, the correct <code>/dev</code> file is reported when the “Blue Pill” is connected via USB. The utilities <code>dmesg</code>, <code>journalctl</code>, and others will show output similar to:</p>
<pre><code> usb m-n.p.q: new full-speed USB device number N using xhci_hcd
usb m-n.p.q: New USB device found, idVendor=0483, idProduct=5740
usb m-n.p.q: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb m-n.p.q: Product: STM32 Virtual COM Port
usb m-n.p.q: Manufacturer: STMicroelectronics
usb m-n.p.q: SerialNumber: 1234567890abcdef01234567
cdc_acm m-n.p.q:1.0: ttyACMn: USB ACM device
</code></pre>
<p>where “m”, “n”, “p”, “q”, “N”, the <code>SerialNumber</code>, and the “n” in <code>ttyACMn</code> are arbitrary values.</p>
<p>If the “Blue Pill” is already plugged in and more than one <code>/devttyACMn</code> file exists, various Linux utilities can be used to determine which is correct. For example:</p>
<pre><code> $ for NAME in /dev/ttyACM* ; do
> echo $NAME
> udevadm info --name=$NAME | egrep '0483|5740|ID_SERIAL_SHORT'
> done
</code></pre>
<p>Each <code>/dev/tttyACMn</code> corresponding to a buck50 “Blue Pill” will output lines of the form:</p>
<pre><code>/dev/ttyACMn
E: ID_MODEL_ID=5740
E: ID_SERIAL_SHORT=1234567890abcdef01234567
E: ID_VENDOR_ID=0483
</code></pre>
<p>while non-“Blue Pill”/non-buck50 devices will not have the <code>E: ID_MODEL_ID=5740</code> and <code>ID_VENDOR_ID=0483</code> lines.</p>
<p>If multiple buck50 “Blue Pill”s are connected (which can be very useful <a href="#footnote_12"><sup>12</sup></a>) (type <code>help reset ganged=</code> for a usage example), once again the easiest way to tell which <code>/dev/ttyACMn</code> file corresponds to which is to plug them into USB sequentially and watch the <code>dmesg</code>, etc. output.</p>
<p>After multiple <code>buck50.py</code> programs are connected to the multiple buck50 devices via the appropriate <code>/dev/ttyACM0</code> files, which one is which can be determined by the serial numbers reported at program startup. The serial numbers can matched to physical hardware by noting the <code>dmesg</code>, etc. output, or by the <code>udevadm</code> command described above.</p>
<p>Finally (and easier), the <code>reset blink</code> command will blink the user LED of the connected “Blue Pill” device for identification purposes.</p>
<p>On macOS the device special files should be of the form <code>/dev/tty.usbmodemWXYZ...</code> for some value of “WXYZ…” <a href="#footnote_13"><sup>13</sup></a>. As noted above, it is unlikely that the <code>buck50.py</code> program will function in a Microsoft Windows® environment without significant revisions.</p>
<p><a name="review_license"></a></p>
<h4 id="reviewlicense">review license</h4>
<p>Review the license:</p>
<pre><code> $1.50: warranty
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License , or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, write to
The Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor
Boston, MA 02110-1335 USA
</code></pre>
<p><a name="help"></a></p>
<h4 id="help">help</h4>
<pre><code> $1.50: help
Help:
Commands, Configurations, Actions, Parameters, Values:
<command> [[<action>] [<parameter>=<value>] ...] [<configuration> [<action>]
[<parameter>=<value>] ...] ... [# comment ...]
Syntax:
symbol explanation
------ -----------
<command> command name
[...] optional
[<action>] optional action name
[<parameter>=<value>] optional parameter=value names
<configuration> configuration name
... optional repeats
[# comment ...] text from "#" to end of line ignored
Verbose explanation:
- Program executes Commands
- Commands use Parameter=Value settings
- Parameter=Value settings are grouped into Configurations
- Configurations may have optional Actions
- Parameters have default Values
- Parameters retain their Values until changed by new Parameter=Value setting,
"configure load", or program exit/restart.
- Commands have a primary Configuration, with same name as the Command
- Commands may have one or more secondary Configurations
- Primary configuration is initial current Configuration
- Configuration remains current until changed by explicit new Configuration
- Only current Configuration's Parameters=Values can be set
- Configurations may be used by multiple Commands
- Only one Action allowed per Configuration per Command
Examples:
logic
- Command with no Parameter=Value settings, Actions, or secondary
Configurations
usart baud=19.2kHz
- Command with Parameter=Value setting in primary Configuration
pulse time=125ms mode1=rise time1=15%
- Command with multiple Parameters=Values settings in primary Configuration
monitor lines 6=clock 7=data
- Command with multiple Parameter=Value settings in secondary Configuration
reset halt
- Command with Action in primary Configuration
monitor spi master
- Command with Action in secondary Configuration
monitor rate=10Hz pb4-11=disabled adc0 enable
s/h+adc=239.5+12.5@12MHz->47.6kHz spi slave miso=push-pull monitor
file=monitored.txt output=both
- Command with multiple Parameters=Values settings in primary Configuration,
two secondary Configurations each with a Parameter=Value setting and an
Action, then explicit primary Configuration with two more Parameter=Value
settings
Commands:
configure, trigger, logic, oscope, dump, monitor, pulse, gpio, usart, spi,
i2c, numbers, reset, warranty, help, using, quit
Configurations:
configure, monitor, pulse, numbers, gpio, usart, spi, i2c, adc0, adc1, adc2,
adc3, adc4, adc5, adc6, adc7, logic, oscope, dump, lines, reset, socket,
pty, ipc
Time/Frequency Errors:
- Many time and/or frequency parameters have limited precision due to their
STM32F103 hardware implementations (32 bit register values, etc). Arbitrary
Parameter=Values are rounded to the nearest achievable value and the error
difference reported. Examples:
31.125μs(error:-5.5ns)
- time is 5.5ns shorter than requested
3.13043MHz=319.444ns(error:-28.8452kHz,+2.91663ns)
- frequency is 28.8452kHz lower, time 2.91663ns longer, than requested
monitor
- Command with no Parameters=Values settings, Actions, or Configurations.
All current Parameter=Value settings in all Configurations remain in
effect.
More help:
help using
help <command>
help <command> <parameter>
help <command> <configuration>
help <command> <configuration> <parameter>
</code></pre>
<p>Commands, configurations, actions, parameters, values: What could be simpler? ;) Hopefully further help, below, experimenting using the program (and, as always <a href="#footnote_11"><sup>11</sup></a>, using the <a href="#tab_key_redux">tab key</a>) will clarify.</p>
<p><a name="usage_help"></a></p>
<h4 id="usagehelp">usage help</h4>
<pre><code> $1.50: help using
Help for command "using":
Input:
- Type "<command> ..." followed by ENTER key
- Abbreviate any command, configuration, parameter, or value to its unique
prefix
Example:
m d=i r=4k a w=2 spe=6
same as:
monitor duration=infinite rate=4kHz adc weight=2 speed=600kHz=1.66667μs
- "#" in line: rest of line ignored
Completion:
key(s) result:
------ -------
<TAB> Completes partially typed command, configuration, parameter,
or value (if unique prefix), else ...
<TAB><TAB> ... sounds terminal bell and second <TAB> prints list
of possible completions
Example:
n<TAB> i<TAB>3 o<TAB>p<TAB> m<TAB><TAB>g<TAB> l<TAB><TAB>o<TAB>16
completes:
numbers increment=3 open-pull=push-pull mode=gray low=16
(note could use abbreviations instead):
n i=3 o=p m=g lo=16
Example:
usart p<TAB><TAB>
prints list:
parity= phase= ports= pty
then:
usart pa<TAB>
completes:
usart parity=
Example (note space after "usart", before double <TAB> press):
spi <TAB><TAB>
prints list:
ascii-num= endian= mode= pull= snoop= xmit-only=
baud= idle= nss-time= rate= socket
busy-wait= ipc nss= rx-wait= speed=
disable master phase= select= spi
end= miso= pty slave tx-data=
then:
spi x<TAB>
completes:
spi xmit-only=
and:
spi xmit-only=<TAB><TAB>
prints list:
disabled enabled
and finally:
spi xmit-only=e<TAB>
results in:
spi xmit-only=enabled
Editing, history:
(only basics listed, web search "GNU readline" for more)
key result:
------------------------- -------
<LEFT-ARROW> or <CTRL+b> cursor left
<RIGHT-ARROW> or <CTRL+f> cursor right
<BACKSPACE> or <DELETE> delete character
<HOME> or <CTRL+a> cursor to start of line
<END> or <CTRL+f> cursor to end of line
<UP-ARROW> or <CTRL+p> previous input line
<DOWN-ARROW> or <CTRL+n> next input line
<CTRL+r> search input history
<CTRL+g> clear input line
Alternate "?" help syntax:
"?" anywhere in line same as "help <line>" (line truncated at "?")
"?" can immediately follow command/configuration/parameter/value or be
separated by space
Examples ("?", " ?", and " ? " always equivalent):
"?" syntax same as:
---------- --------
usart? help usart
usart ? help usart
numbers rate? help numbers rate
numbers rate=? help numbers rate=
numbers rate=2Hz? help numbers rate=2Hz
monitor adc3? help monitor adc3
configure usart baud? help configure usart baud
configure pulse time=1kHz spi? help configure spi
spi mode=? endian=lsb help spi mode=
monitor duration=? adc weight=3 help monitor duration
configure gpio end=XX rate=? pulse time=1s help gpio rate
More help:
Type "help" for general help on commands, configurations, actions, and
parameters
</code></pre>
<p>There it is: Abbreviations, the full <code>TAB</code> key magic, the rest of the line editing capabilities, and a quicker way to get help. Commands and other elements in the following examples are fully typed, but remember that abbreviations or <code>TAB</code> completion can always be used instead.</p>
<p>Once more, it cannot be overemphasized:</p>
<ul>
<li>PRESS THE <code>TAB</code> KEY OFTEN!!! <a href="#footnote_14"><sup>14</sup></a></li>
</ul>
<p>See <a href="#future_work">Future work</a>, below, for small problem with “?” alternate help syntax implementation.</p>
<p><a name="non_intuitive_names"></a>
Also note that the non-intuitive command names (<code>gpio</code> instead of <code>parallel</code>, <code>numbers</code> instead of <code>counter</code>) were chosen in an attempt to make commands (and other strings) unique in their first letter (or first few) for easy <code>TAB</code> completion.</p>
<p>Continuing the help system tour …</p>
<p><a name="configure_command"></a></p>
<h4 id="configurecommand"><code>configure</code> command</h4>
<p>The <code>configure</code> command displays, changes, saves, and or loads any parameters in any or all configurations.</p>
<pre><code> $1.50: help configure
Help for command "configure":
View, change, load, and/or save settings
- View any or all configurations' parameters:
- Save or load all configurations' parameters to/from disk file
- Adjust all time output values (trim hardware CPU clock)
Command usage:
configure [<parameter>=<value> ...] [<action>] [<configuration>
<parameter>=<value ...] [<action>]
Configurations (primary="configure"):
configure, lines, numbers, gpio, usart, adc0, adc1, adc2, adc3, adc4, adc5,
adc6, adc7, spi, i2c, pulse, monitor, logic, oscope, dump, reset, socket,
pty, ipc
Type "help configure <configuration>" for configuration description,
parameters, and actions
Type "help configure <configuration> <parameter>" for parameter description
</code></pre>
<h5 id="configureconfiguration"><code>configure</code> configuration</h5>
<p>As with all commands, <code>configure</code> has its own default configuration, also named “configure” <a href="#footnote_15"><sup>15</sup></a>, with a set of parameters and actions:</p>
<pre><code> $1.50: help configure configure
Help for configuration "configure" (e.g. "configure configure"):
Load and/or save all configuration parameters to file
- Will append ".b50" to file name if missing
- Supports <TAB> completion of filenames
Command/configuration usage:
configure [<parameter>=<value> ...] [<action>]
Actions:
save Save all configurations/parameters to file, name...
load Load all configurations/parameters to file, name...
adjust Adjust reported times by "trim" parameter value
Parameters:
file= Name of ".b50" file to load or save configuratio...
trim= Trim all reported times by factor of X/Y where X...
Configuration "configure" used by commands:
configure
Type "help configure" for command description
Type "help configure configure <parameter>" for parameter description
Type "help configure configure <action>" for action description
</code></pre>
<h5 id="configureparametersandactions"><code>configure</code> parameters and actions</h5>
<p>Configuration help (for any configuration) truncates long explanations. To see the full text:</p>
<pre><code> $1.50: help configure save
Help for action "save" (e.g. "configure configure save"):
- Save all configurations/parameters to file, name specified with"file="
parameter
Type "help configure configure" for list of configure configuration actions
Type "help configure" for command description
$1.50: help configure load
Help for action "load" (e.g. "configure configure load"):
- Load all configurations/parameters to file, name specified with"file="
parameter
Type "help configure configure" for list of configure configuration actions
Type "help configure" for command description
$1.50: help configure adjust
Help for action "adjust" (e.g. "configure configure adjust"):
- Adjust reported times by "trim" parameter value
Type "help configure configure" for list of configure configuration actions
Type "help configure" for command description
$1.50: help configure file=
Help for parameter "file=" (e.g. "configure configure file="):
- Name of ".b50" file to load or save configurations and parameters. ".b50"
suffix will be appended if missing. See "load" and "save" actions.
Current value:
Valid values: <any valid file or path name>
Type "help configure configure" for list of configure configuration parameters
Type "help configure" for command description
$1.50: help configure trim=
Help for parameter "trim=" (e.g. "configure configure trim="):
- Trim all reported times by factor of X/Y where X is currently reported time
and Y is desired. Use "adjust" action to effect.
Current value: 1.00000/1.00000
Valid values: <X/Y with X and Y floating point numbers>
Type "help configure configure" for list of configure configuration parameters
Type "help configure" for command description
</code></pre>
<p>Customization of <code>buck50.py</code> can be done by changing any of the various commands' configuration parameters and saving with <code>configure file=<filename> save</code> <a href="#footnote_16"><sup>16</sup></a>. The customizations can manually loaded with <code>configure file=<filename> load</code>, or automatically at <code>buck50.py</code> startup with the <code>--file=</code> commandline option.</p>
<p><a name="reset_default"></a>
Note that <code>buck50.py</code> has no explicit “reset defaults” command or action. Again, this can be easily implemented via <code>configure file=<filename> save</code> before any configuration changes (and without commandline <code>--file=</code>) and reloaded as desired.</p>
<p>Note that the <code>configure</code> command is useful not only for changing its own configuration parameters, but also for changing other command’s configurations' parameters without executing those commands. Examples:</p>
<pre><code> $1.50: configure trim=1.00/0.97
configure: trim=1.00000/0.970000
configure:
file : default.b50
trim : 1.00000/0.970000
$1.50: configure monitor duration=90s
monitor: duration=1.5m
monitor:
rate : 4Hz=250ms
duration : 1.5m
pb4-11 : enabled
file :
output : both
printf : %7.3f
$1.50: configure lines 4=NSS 5=SCK 6=MISO 7=MOSI spi slave miso=push-pull tx-data=12.34.56
spi: slave
lines: 4=NSS
lines: 5=SCK
lines: 6=MISO
lines: 7=MOSI
spi: miso=push-pull
spi: tx-data=12.34.56
lines:
4 : NSS
5 : SCK
6 : MISO
7 : MOSI
8 : grn
9 : blu
10 : vio
11 : gry
spi:
mode : slave
xmit-only : disabled
snoop : disabled
select : software
baud : 281.25KHz
endian : msb
idle : low
phase : 1st
miso : push-pull
pull : floating
speed : 2MHz
nss : floating
tx-data : 12.34.56
rate : unlimited
busy-wait : 1ms
rx-wait : 10ms
nss-time : zero
ascii-num : numeric
end : END
</code></pre>
<p>Moving on to the actual functional, results–producing commands and their configurations …</p>
<p><a name="logic_command"></a></p>
<h4 id="logiccommand"><code>logic</code> command</h4>
<pre><code> $1.50: help logic
Help for command "logic":
Digital logic analyzer.
- capture samples of logic levels on ports PB4(lsb) through PB11(msb)
- samples recorded only if level changes on any port
- samples also recorded every 0.233016889 seconds regardless if any change
- sampling starts when trigger condition met (see "help trigger")
- sampling continues until first of:
. user interrupt (<ENTER> key)
. duration elapsed ("logic duration=")
. number of samples ("logic edges=") (incl. extra samples @ 233ms)
. memory full
- see "help logic mode" for sampling speed
- see "help trigger" for triggering
- see "help reset ganged=" and "help reset ext-trig" for external triggering and