mirror of
https://github.com/peter-tanner/peter-tanner.github.io.git
synced 2024-11-30 12:00:18 +08:00
Compare commits
6 Commits
ffa946c610
...
9df0e32450
Author | SHA1 | Date | |
---|---|---|---|
9df0e32450 | |||
efbbf5f0db | |||
029c8f2ae3 | |||
66c0ba980c | |||
a354d754a8 | |||
d92ee8ea56 |
|
@ -105,11 +105,11 @@ Make table like this for delta time (required for followthrough marks):
|
|||
Tip: when using pin planner, you can copy paste multiple selections if you are using vscode multi cursors and copying from the markdown version of this page. Useful for filling out seven segment displays.
|
||||
|
||||
| Key | Value | Notes |
|
||||
| ----------------------------- | -------------- | -------------------------------------------------------------- |
|
||||
| ----------------------------- | -------------- | -------------------------------------------------------------------------------------- |
|
||||
| Part number | 10M50DAF484C7G | |
|
||||
| 50 MHz signal (MAX10_CLK1_50) | PIN_P11 | |
|
||||
| KEY0 | PIN_B8 | ⚠ IMPORTANT: USE 2.5V Schmitt trigger I/O standard to debounce |
|
||||
| KEY1 | PIN_A7 | ⚠ IMPORTANT: USE 2.5V Schmitt trigger I/O standard to debounce |
|
||||
| KEY0 | PIN_B8 | Default: HIGH (Pullup). ⚠ IMPORTANT: USE 2.5V Schmitt trigger I/O standard to debounce |
|
||||
| KEY1 | PIN_A7 | Default: HIGH (Pullup). ⚠ IMPORTANT: USE 2.5V Schmitt trigger I/O standard to debounce |
|
||||
| SW0 | PIN_C10 | |
|
||||
| SW1 | PIN_C11 | |
|
||||
| SW2 | PIN_D12 | |
|
||||
|
@ -137,7 +137,7 @@ Tip: when using pin planner, you can copy paste multiple selections if you are u
|
|||
| HEX04 | PIN_E16 | |
|
||||
| HEX05 | PIN_D17 | |
|
||||
| HEX06 | PIN_C17 | |
|
||||
| HEX07 | PIN_D15 | |
|
||||
| HEX07 | PIN_D15 | DECIMAL POINT |
|
||||
| HEX10 | PIN_C18 | |
|
||||
| HEX11 | PIN_D18 | |
|
||||
| HEX12 | PIN_E18 | |
|
||||
|
@ -145,7 +145,7 @@ Tip: when using pin planner, you can copy paste multiple selections if you are u
|
|||
| HEX14 | PIN_A17 | |
|
||||
| HEX15 | PIN_A18 | |
|
||||
| HEX16 | PIN_B17 | |
|
||||
| HEX17 | PIN_A16 | |
|
||||
| HEX17 | PIN_A16 | DECIMAL POINT |
|
||||
| HEX20 | PIN_B20 | |
|
||||
| HEX21 | PIN_A20 | |
|
||||
| HEX22 | PIN_B19 | |
|
||||
|
@ -153,7 +153,7 @@ Tip: when using pin planner, you can copy paste multiple selections if you are u
|
|||
| HEX24 | PIN_B21 | |
|
||||
| HEX25 | PIN_C22 | |
|
||||
| HEX26 | PIN_B22 | |
|
||||
| HEX27 | PIN_A19 | |
|
||||
| HEX27 | PIN_A19 | DECIMAL POINT |
|
||||
| HEX30 | PIN_F21 | |
|
||||
| HEX31 | PIN_E22 | |
|
||||
| HEX32 | PIN_E21 | |
|
||||
|
@ -161,7 +161,7 @@ Tip: when using pin planner, you can copy paste multiple selections if you are u
|
|||
| HEX34 | PIN_C20 | |
|
||||
| HEX35 | PIN_D19 | |
|
||||
| HEX36 | PIN_E17 | |
|
||||
| HEX37 | PIN_D22 | |
|
||||
| HEX37 | PIN_D22 | DECIMAL POINT |
|
||||
| HEX40 | PIN_F18 | |
|
||||
| HEX41 | PIN_E20 | |
|
||||
| HEX42 | PIN_E19 | |
|
||||
|
@ -169,7 +169,7 @@ Tip: when using pin planner, you can copy paste multiple selections if you are u
|
|||
| HEX44 | PIN_H19 | |
|
||||
| HEX45 | PIN_F19 | |
|
||||
| HEX46 | PIN_F20 | |
|
||||
| HEX47 | PIN_F17 | |
|
||||
| HEX47 | PIN_F17 | DECIMAL POINT |
|
||||
| HEX50 | PIN_J20 | |
|
||||
| HEX51 | PIN_K20 | |
|
||||
| HEX52 | PIN_L18 | |
|
||||
|
@ -177,7 +177,7 @@ Tip: when using pin planner, you can copy paste multiple selections if you are u
|
|||
| HEX54 | PIN_M20 | |
|
||||
| HEX55 | PIN_N19 | |
|
||||
| HEX56 | PIN_N20 | |
|
||||
| HEX57 | PIN_L19 | |
|
||||
| HEX57 | PIN_L19 | DECIMAL POINT |
|
||||
|
||||
identity:
|
||||
|
||||
|
@ -192,3 +192,42 @@ identity:
|
|||
"010000000"
|
||||
"100000000"
|
||||
```
|
||||
|
||||
## identities
|
||||
|
||||
| Name | 1 | 2 |
|
||||
| --------------- | --------------------------------------- | -------------------------------------------- |
|
||||
| Absorption rule | $A(A+B)=A$ | $A+AB=A$ |
|
||||
| De Morgan's law | $\overline{AB}=\overline A+\overline B$ | $\overline{A+B}=\overline A\cdot\overline B$ |
|
||||
| Idempotency | $AA=A$ | $A+A=A$ |
|
||||
|
||||
## fsm template
|
||||
|
||||
```vhdl
|
||||
entity fsm is port (
|
||||
clk,nrst,x in : std_logic;
|
||||
...
|
||||
);
|
||||
end fsm;
|
||||
|
||||
architecture behavioral of fsm is
|
||||
type state is {sdefault, s1, s2, ...};
|
||||
signal ps, ns : state; -- present_state, next_state
|
||||
begin
|
||||
process (clk, nrst)
|
||||
begin
|
||||
if (nrst = '0') then
|
||||
ps <= sdefault;
|
||||
elsif (rising_edge(clk)) then
|
||||
ps <= ns;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
process (x,ps)
|
||||
begin
|
||||
case x is
|
||||
when s1 =>
|
||||
[...]
|
||||
end process;
|
||||
end behavioral;
|
||||
```
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
---
|
||||
title: "Dev log: GPS receiver based on MAX2769 and Zynq 7010 FPGA"
|
||||
author: peter
|
||||
date: 2024-10-02 20:10:44 +0800
|
||||
categories: [Electronics, Programming] # Blogging | Electronics | Programming | Mechanical | SelfHosting
|
||||
tags: [rf, electronics, fpga, ebaz4205, max2769, zynq7010] # systems | embedded | rf | microwave | electronics | solidworks | automation | tip
|
||||
# image: assets/img/2024-10-02-Dev-log-GPS-receiver/preview.png
|
||||
---
|
||||
|
||||
## 🚧🚧 THIS PAGE IS NOT FINISHED 🚧🚧
|
||||
|
||||
## Notes:
|
||||
|
||||
https://github.com/iliasam/STM32F4_SDR_GPS?tab=readme-ov-file
|
||||
|
||||
https://habr.com/ru/articles/789382/
|
||||
|
||||
https://dsp.stackexchange.com/questions/92028/max2769-i-q-for-signal-acquisition-tracking
|
||||
|
||||
## Datasheet
|
||||
|
||||
> The MAX2769B features an on-chip ADC to digitize the
|
||||
> downconverted GPS signal. The maximum sampling
|
||||
> rate of the ADC is approximately 50Msps. The sampled
|
||||
> output is provided in a **2-bit format (1-bit magnitude and
|
||||
> 1-bit sign) by default** and also can be configured as a
|
||||
> **1-bit or 2-bit** in both I and Q channels, or 1-bit, 2-bit, or
|
||||
> 3-bit in the I channel only. The ADC supports the digital
|
||||
> outputs in three different formats: the unsigned binary,
|
||||
> the sign and magnitude, or the two’s complement format
|
||||
> by setting bits FORMAT in Configuration register 2. MSB
|
||||
> bits are output at I1 or Q1 pins and LSB bits are output at
|
||||
> I0 or Q0 pins, for I or Q channel, respectively. In the case
|
||||
> of 3-bit, output data format is selected in the I channel
|
||||
> only, the MSB is output at I1, the second bit is at I0, and
|
||||
> the LSB is at Q1.
|
||||
|
||||
Surely two-bit correlation is the same process, just with more precision because of the additional bit?
|
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
title: Buggy shell extensions causing Windows explorer to hang
|
||||
author: peter
|
||||
date: 2024-10-05 22:44:41 +0800
|
||||
categories: [Blogging] # Blogging | Electronics | Programming | Mechanical | SelfHosting
|
||||
tags: [getting started] # systems | embedded | rf | microwave | electronics | solidworks | automation | tip
|
||||
# image: assets/img/2024-10-05-Buggy-shell-extensio/preview.png
|
||||
---
|
||||
|
||||
If you are having issues where right-clicking causes explorer to lock up/hang for a painfully long amount of time (~30 seconds) it could be due to a buggy shell extension as in my case.
|
||||
|
||||
I downloaded [ShellExView](https://www.nirsoft.net/utils/shexview.html) which is a small program that can disable/enable shell extensions.
|
||||
|
||||
I went and checked `Options > Hide all Microsoft extensions` since I assumed all OS extensions worked fine.
|
||||
|
||||
I then went to `Options > Filter by extension type > Context Menu` since this type is what is used in Explorer.
|
||||
|
||||
Then I simply binary searched my way to finding the buggy shell extension (split the list of extensions in half, see which half causes the error. Then split that half of the list in half again and find which half causes the error. Repeat until one extension is found).
|
||||
|
||||
![Shellexview](/assets/img/2024-10-05-Buggy-shell-extensio/shellexview.png)
|
||||
|
||||
Looks like the issue is "DriveFS ContextMenu Handler" which is used by Google Drive. For whatever reason this is causing issues. Disabling this extension resolved the issue.
|
||||
|
||||
For reference, at the time of writing I haven't used Google Drive client in a while, at least since my old work. Looks like something has gone wrong with my install since starting Google Drive doesn't create the system tray icon/widget, so I guess if the client is having issues the shell extension is probably timing out when it cannot connect to the client is my guess.
|
|
@ -0,0 +1,179 @@
|
|||
---
|
||||
title: Opening .sig files from B&K LDS shaker table machines in Python
|
||||
author: peter
|
||||
date: 2024-10-06 16:59:44 +0800
|
||||
categories: [Programming, Mechanical] # Blogging | Electronics | Programming | Mechanical | SelfHosting
|
||||
tags: [python, com, 32-bit, tip] # systems | embedded | rf | microwave | electronics | solidworks | automation | tip
|
||||
# image: assets/img/2024-10-06-Opening-sig-files-fr/preview.png
|
||||
---
|
||||
|
||||
## Introduction
|
||||
|
||||
Brüel & Kjær have a [line of electrodynamic shaker tables](https://www.hbkworld.com/en/products/vibration-testing/shaker-systems#!ref_bksv.com) that use their LDS Dactron signal analyzer which produce proprietary `.sig` files.
|
||||
|
||||
Example of a `.sig` file's header:
|
||||
|
||||
```bash
|
||||
$ xxd input1\(t\).sig | head -n 10
|
||||
00000000: 44f7 0000 0744 4143 5452 4f4e 5804 0000 D....DACTRONX...
|
||||
00000010: 0100 0000 0004 0000 0100 0000 0004 0000 ................
|
||||
00000020: 0100 0000 0100 0000 0004 0000 0969 6e70 .............inp
|
||||
00000030: 7574 3128 7429 0969 6e70 7574 3128 7429 ut1(t).input1(t)
|
||||
00000040: 0969 6e70 7574 3128 7429 0156 0156 0000 .input1(t).V.V..
|
||||
00000050: 1253 6570 7465 6d62 6572 2032 362c 2032 .September 26, 2
|
||||
00000060: 3030 3608 3130 3a35 373a 3338 0856 5055 006.10:57:38.VPU
|
||||
00000070: 2d32 3232 3200 0000 0000 0000 00a5 e2ec -2222...........
|
||||
00000080: c367 d805 3f00 0000 0000 0000 0000 0000 .g..?...........
|
||||
```
|
||||
|
||||
As shown in the [user manual for their PC software](https://www.bksv.com/downloads/dactron/shakercontroller/manuals/shakercontroluserguide6.3.pdf), they provide an ActiveX Signal Reader which provides some functions to enable the `.sig` file to be opened in "Visual Basic, MATLAB, LabView, C++ and so on".
|
||||
|
||||
## Tutorial on how to use in Python
|
||||
|
||||
1. Download [Shaker Control](https://www.bksv.com/en/services/downloads/vibration-control-software/version-9). While a license key is required to use the software, we only need the `DactronSignal.dll` file.
|
||||
2. Install the software to a directory of your choosing, I think it installs in `C:\Program Files (x86)` by default but I am not sure since I chose to install it to `D:\Programs`.
|
||||
3. Go to `Bruel and Kjaer\LASER and COMET Vibration Control\Shaker Control LaserUSB\bin` and copy `DactronSignal.dll` to a directory of your choosing.
|
||||
4. Create a command prompt and `cd` to the directory containing the DLL and register the DLL:
|
||||
|
||||
```bat
|
||||
regsvr32 .\DactronSignal.dll
|
||||
```
|
||||
|
||||
5. Create a **32-bit** Python virtual environment and activate the virtual environment OR use a **32-bit** Python installation. It must be 32-bit since the DLL is 32-bit, if you use 64-bit it will not find the class, and you will get this error:
|
||||
|
||||
```powershell
|
||||
PS C:\<path>\signal_reader> python
|
||||
Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] on win32
|
||||
--- ✂
|
||||
PS C:\<path>\signal_reader> python .\test.py
|
||||
--- ✂
|
||||
pywintypes.com_error: (-2147221021, 'Operation unavailable', None, None)
|
||||
|
||||
During handling of the above exception, another exception occurred:
|
||||
--- ✂
|
||||
pywintypes.com_error: (-2147221164, 'Class not registered', None, None)
|
||||
PS C:\<path>\signal_reader>
|
||||
|
||||
```
|
||||
|
||||
6. Install `pywin32` (and `numpy` and `matplotlib` for plotting)
|
||||
|
||||
```powershell
|
||||
python -m pip install pywin32
|
||||
python -m pip install numpy matplotlib
|
||||
```
|
||||
|
||||
7. Create a script to see if loading the DLL works. Use the provided `FFT1(f).sig` file for testing:
|
||||
|
||||
[⬇ Download `FFT1(f).sig` for testing this script](</assets/lib/2024-10-06-Opening-sig-files-fr/FFT1(f).sig>)
|
||||
|
||||
```python
|
||||
import win32com.client
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
dac_signal = win32com.client.Dispatch("SignalReader.DacSignal.1")
|
||||
|
||||
success = dac_signal.LoadSignal("FFT1(f).sig")
|
||||
|
||||
if success:
|
||||
print("Signal loaded successfully")
|
||||
else:
|
||||
print("Error loading signal")
|
||||
exit(1)
|
||||
```
|
||||
|
||||
[⬇ Additional file: `G1,1(f).sig`](</assets/lib/2024-10-06-Opening-sig-files-fr/G1,1(f).sig>)\
|
||||
[⬇ Additional file: `input1(t).sig`](</assets/lib/2024-10-06-Opening-sig-files-fr/input1(t).sig>)
|
||||
|
||||
8. If it loaded successfully, you may try the following script which was adapted to Python from the example MATLAB script given in the documentation `Recall_and_plot_G11.m`. This should provide the following plot:
|
||||
|
||||
![FFT1(f).sig plot](/assets/img/2024-10-06-Opening-sig-files-fr/plot_fft.png)
|
||||
|
||||
```python
|
||||
import win32com.client
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
dac_signal = win32com.client.Dispatch("SignalReader.DacSignal.1")
|
||||
|
||||
success = dac_signal.LoadSignal("FFT1(f).sig")
|
||||
|
||||
if success:
|
||||
print("Signal loaded successfully")
|
||||
else:
|
||||
print("Error loading signal")
|
||||
exit(1)
|
||||
|
||||
# Get slice number of the signal, for G1,1(f) signal, the value is 1.
|
||||
nSliceNum = dac_signal.NumofSlice
|
||||
# Get number of samples.
|
||||
nNumofSamples = dac_signal.NumOfSamples
|
||||
|
||||
# slice index is 0 based
|
||||
indexSlice = 0
|
||||
# Sample index is 0 based
|
||||
indexFirstSmp = 0
|
||||
|
||||
# Get X Begin
|
||||
xBegin = dac_signal.XaxisBegin
|
||||
# Get X Delta
|
||||
xDelta = dac_signal.XaxisDelta
|
||||
xSpacingEven = dac_signal.XaxisSpacingEven
|
||||
|
||||
varX = np.zeros(nNumofSamples)
|
||||
|
||||
if xSpacingEven == 1:
|
||||
# When X-axis is evenly spaced, generate values with X(i+1) = X(i) + XDelta
|
||||
varX = np.arange(xBegin, xBegin + xDelta * nNumofSamples, xDelta)
|
||||
else:
|
||||
# When X-axis is unevenly spaced, generate values with X(i+1) = X(i) * XDelta
|
||||
for i in range(nNumofSamples):
|
||||
varX[i] = xBegin * (xDelta**i)
|
||||
|
||||
# Get Y data (first slice)
|
||||
varY = dac_signal.GetData(indexSlice, indexFirstSmp, nNumofSamples - 1)
|
||||
|
||||
# Convert varY from a COM array to a numpy array
|
||||
varY = np.array(varY)
|
||||
|
||||
# Get data type (1: real, 2: complex)
|
||||
DataType = dac_signal.DataType
|
||||
|
||||
# Plot the data based on the data type
|
||||
if DataType == 1: # Real data
|
||||
plt.figure()
|
||||
plt.loglog(varX, varY)
|
||||
plt.title("Real")
|
||||
plt.xlabel("X")
|
||||
plt.ylabel("Y")
|
||||
plt.grid(True)
|
||||
plt.show()
|
||||
else: # Complex data
|
||||
varRealY = varY[::2] # Real part
|
||||
varImgY = varY[1::2] # Imaginary part
|
||||
|
||||
plt.figure()
|
||||
plt.subplot(2, 1, 1)
|
||||
plt.semilogy(varX, varRealY)
|
||||
plt.title("Complex - Real Part")
|
||||
plt.xlabel("X")
|
||||
plt.ylabel("Real Part")
|
||||
plt.grid(True)
|
||||
|
||||
plt.subplot(2, 1, 2)
|
||||
plt.semilogy(varX, varImgY)
|
||||
plt.title("Complex - Imaginary Part")
|
||||
plt.xlabel("X")
|
||||
plt.ylabel("Imaginary Part")
|
||||
plt.grid(True)
|
||||
|
||||
plt.tight_layout()
|
||||
plt.show()
|
||||
```
|
||||
|
||||
9. You may unregister the DLL after use like so if you don't trust an old dll lying around on your system.
|
||||
|
||||
```bat
|
||||
regsvr32 /u .\DactronSignal.dll
|
||||
```
|
BIN
assets/img/2024-10-01-Fixing-a-Missilework/jtag_pinout.png
Normal file
BIN
assets/img/2024-10-01-Fixing-a-Missilework/jtag_pinout.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.7 MiB |
BIN
assets/img/2024-10-05-Buggy-shell-extensio/shellexview.png
Normal file
BIN
assets/img/2024-10-05-Buggy-shell-extensio/shellexview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 163 KiB |
BIN
assets/img/2024-10-06-Opening-sig-files-fr/plot_fft.png
Normal file
BIN
assets/img/2024-10-06-Opening-sig-files-fr/plot_fft.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 75 KiB |
BIN
assets/lib/2024-10-06-Opening-sig-files-fr/FFT1(f).sig
Normal file
BIN
assets/lib/2024-10-06-Opening-sig-files-fr/FFT1(f).sig
Normal file
Binary file not shown.
BIN
assets/lib/2024-10-06-Opening-sig-files-fr/G1,1(f).sig
Normal file
BIN
assets/lib/2024-10-06-Opening-sig-files-fr/G1,1(f).sig
Normal file
Binary file not shown.
BIN
assets/lib/2024-10-06-Opening-sig-files-fr/input1(t).sig
Normal file
BIN
assets/lib/2024-10-06-Opening-sig-files-fr/input1(t).sig
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user