Make the first line: sep=;
...and it all magically worked.
Monday, August 2, 2021
Sunday, January 24, 2021
Typescript setup on MacOS.
I finally updated my laptop from a 2013 MacBook Pro to a 2020 MacBook Pro. I treat my computers like an applicance, so I do not generally upgrade or change anything. Having said that, things change over 7 years. I use MacPorts. I am using visual studio code for typescript development.
I will assume that macports is already installed.
The first thing we need to do is install the javascript package manager, npm.
There's a note of interest if you every want to no longer use npm.
Now it's time to install the typescript compiler.
Here's the notes on where it installed things:
Now try it. Let's see if we can see the tcs typescript compiler.
Okay, so this means that either 1) we didn't actually install it or 2) it's not in the path. The first thing to try is the "rehash" command.
Now on to try tsc again.
And that means success.
I will assume that macports is already installed.
The first thing we need to do is install the javascript package manager, npm.
sudo port install npm6
There's a note of interest if you every want to no longer use npm.
npm6 has the following notes:
It is not recommended to install packages globally. But if you do so please
be aware that they won't get cleaned up when you deactivate or uninstall
npm6. Globally installed packages will remain in
/opt/local/lib/node_modules/ until you manually delete them.
Now it's time to install the typescript compiler.
sudo npm install -g typescript
Here's the notes on where it installed things:
/opt/local/bin/tsc -> /opt/local/lib/node_modules/typescript/bin/tsc /opt/local/bin/tsserver -> /opt/local/lib/node_modules/typescript/bin/tsserver + typescript@4.1.3
Now try it. Let's see if we can see the tcs typescript compiler.
% tcs zsh: command not found: tcs
Okay, so this means that either 1) we didn't actually install it or 2) it's not in the path. The first thing to try is the "rehash" command.
rehash
Now on to try tsc again.
% tsc --version Version 4.1.3
And that means success.
Tuesday, January 19, 2021
SSH with no password
I always forget how to do this. If you have to do it more than thrice, write a script.
The script below will allow for login to a remote server without a password.
#!/bin/bash
#Before anything else, set the PATH_SCRIPT variable
pushd `dirname $0` > /dev/null; PATH_SCRIPT=`pwd -P`; popd > /dev/null
PROGNAME=${0##*/}; PROGVERSION=0.1.0
printf '\nWarning!\nThis script creates the ssh key pair so that one does not need\n
to type a password to login more than once. If you know that you\n
need to do this, you probably can check this scripts source\n
to see what is being done.\n\n'
read -r -p "Are you sure you want to continue? [y/N] " response
case "$response" in
[yY][eE][sS]|[yY])
;;
*)
exit 1
;;
esac
printf "This script will put public key on the remove server\n
and now it will ask for your USERNAME and the REMOTESERVER\n"
printf "USERNAME [ENTER]:"
read USERNAME
printf "REMOTESERVER [ENTER]:"
read REMOTESERVER
echo "Will send pair to $USERNAME@$REMOTESERVER"
if [ -f "$HOME/.ssh/id_rsa.pub" ]; then
echo "$HOME/.ssh/id_rsa.pub exists, skipping rsa key generation"
else
#create the key pair
echo "ssh-keygen -t rsa"
ssh-keygen -t rsa
fi
#create the remote directory if it doesn't exist and change the mode
echo "ssh $USERNAME@$REMOTESERVER 'mkdir -p .ssh && chmod 700 .ssh'"
ssh $USERNAME@$REMOTESERVER 'mkdir -p .ssh && chmod 700 .ssh'
echo "cat .ssh/id_rsa.pub | ssh $USERNAME@$REMOTESERVER 'cat >> .ssh/authorized_keys'"
cat $HOME/.ssh/id_rsa.pub | ssh $USERNAME@$REMOTESERVER 'cat >> .ssh/authorized_keys'
Friday, October 23, 2020
libngspice does not get built by default on macports
If you want to use PySpice, you first must have the library bindings installed. The Macports Portfile for ngspice does not build the libraries by default. Here's the symptom:
Find where the portfile is:
OSError: cannot load library 'libngspice.dylib': dlopen(libngspice.dylib, 2)
: image not found. Additionally, ctypes.util.find_library() did not manage
to locate a library called 'libngspice.dylib'
Basically, this means that there's just not a library. I couldn't find it anywhere, and then I realized that macports did not build the library by default. Find where the portfile is:
sudo port file ngspiceNext, you have to edit it to add --with-ngshared:
configure.args --enable-cider \
--enable-xspice \
--enable-pss \
--with-editline \
--with-x \
--enable-debug=no \
--with-ngshared
Finally, you can build the port. If you have already installed it, you need to upgrade it:
sudo port -sn upgrade --force ngspiceI wish that there was some way to append a configuration argument via the command line, but I just cannot seem to make it work, even though there's a facility for it.
freehdl doesn't work as-is on macports
I had to add the following to the portfile:
configure.cxx_stdlib libstdc++
Friday, September 11, 2020
PIC32MZ TFBGA pins are incorrect in the document
The PIC32MZ2048EFH144 is a fine MCU. I have code for both the LQFP-144 and the TFBGA-144, and there's not an obvious way to easily map between code version and the hardware pinouts. For this reason, I made a spreadsheet, and there were errors on the TFBGA-144 pinout. Please note the images below from version DS60001320G of the datasheet:
You will notice M11, M11 and Z13. Firstly, the issue is that there should never have duplicates, and then there's not a "Z" row on the BGA. The correct pins follow:
The A13 was easy to guess, and I confirmed it by toggling the pin. The M11 I had tied to GND, and I confirmed this pin by watching the current fluxuate when I single stepped it while measuring current. The complete and correct pin list follows:
| M11 | RH15 |
| K10 | VSS |
| A13 | RE3 |
The A13 was easy to guess, and I confirmed it by toggling the pin. The M11 I had tied to GND, and I confirmed this pin by watching the current fluxuate when I single stepped it while measuring current. The complete and correct pin list follows:
| PIC32MZ144 QFP pin number | PIC32MZ144 TFBGA pin number | pin ID | voltage tolerance | name | function | |
| 1 | A12 | RG15 | ||||
| 2 | B12 | RA5 | ||||
| 3 | A11 | RE5 | ||||
| 4 | B11 | RE6 | ||||
| 5 | B10 | RE7 | ||||
| 6 | A10 | RC1 | ||||
| 7 | C9 | RJ8 | ||||
| 8 | B9 | RJ9 | ||||
| 9 | A9 | RJ12 | 5V | |||
| 10 | A8 | RJ10 | 5V | |||
| 11 | B8 | RC2 | ||||
| 12 | C8 | RC3 | ||||
| 13 | D8 | RC4 | ||||
| 14 | B7 | RG6 | ||||
| 15 | C7 | RG7 | ||||
| 16 | D7 | RG8 | ||||
| 17 | D6 | VSS | ||||
| 18 | A7 | VDD | ||||
| 19 | C6 | RK0 | 5V | |||
| 20 | B6 | MCLR | 5V | |||
| 21 | A6 | RG9 | ||||
| 22 | D5 | RA0 | ||||
| 23 | A5 | RE8 | ||||
| 24 | B5 | RE9 | ||||
| 25 | C5 | RB5 | ||||
| 26 | A4 | RB4 | ||||
| 27 | B4 | RJ11 | ||||
| 28 | C4 | RJ13 | 5V | |||
| 29 | C3 | RJ14 | 5V | |||
| 30 | B3 | RJ15 | 5V | |||
| 31 | C2 | RB3 | ||||
| 32 | D4 | VSS | ||||
| 33 | A3 | VDD | ||||
| 34 | B2 | RB2 | ||||
| 35 | A2 | RB1 | ||||
| 36 | A1 | RB0 | ||||
| 37 | B1 | RB6 | ||||
| 38 | C1 | RB7 | ||||
| 39 | D2 | RA9 | ||||
| 40 | D3 | RA10 | ||||
| 41 | D1 | AVDD | ||||
| 42 | E4 | AVSS | ||||
| 43 | E1 | RH0 | ||||
| 44 | E2 | RH1 | ||||
| 45 | E3 | RH2 | 5V | |||
| 46 | F4 | RH3 | 5V | |||
| 47 | F3 | RB8 | ||||
| 48 | F2 | RB9 | ||||
| 49 | F1 | RB10 | ||||
| 50 | G1 | RB11 | ||||
| 51 | G2 | RK1 | 5V | |||
| 52 | G3 | RK2 | 5V | |||
| 53 | G4 | RK3 | 5V | |||
| 54 | H4 | VSS | ||||
| 55 | H1 | VDD | ||||
| 56 | H2 | RA1 | ||||
| 57 | H3 | RF13 | ||||
| 58 | J4 | RF12 | ||||
| 59 | J3 | RB12 | ||||
| 60 | J2 | RB13 | ||||
| 61 | J1 | RB14 | ||||
| 62 | K2 | RB15 | ||||
| 63 | K4 | VSS | ||||
| 64 | K1 | VDD | ||||
| 65 | K3 | RH4 | ||||
| 66 | M3 | RH5 | ||||
| 67 | L3 | RH6 | ||||
| 68 | L2 | RH7 | 5V | |||
| 69 | M2 | RD14 | ||||
| 70 | L1 | RD15 | ||||
| 71 | M1 | RC12 | ||||
| 72 | N1 | RC15 | ||||
| 73 | N2 | VBUS | 5V | |||
| 74 | N3 | VBUS3V3 | ||||
| 75 | L4 | VSS | ||||
| 76 | N4 | D- | ||||
| 77 | N5 | D+ | ||||
| 78 | M4 | RF3 | 5V | |||
| 79 | M5 | RF2 | 5V | |||
| 80 | L5 | RF8 | 5V | |||
| 81 | K5 | RH8 | 5V | |||
| 82 | K6 | RH9 | 5V | |||
| 83 | L6 | RH10 | 5V | |||
| 84 | M6 | RH11 | 5V | |||
| 85 | N6 | RA2 | 5V | |||
| 86 | M7 | RA3 | 5V | |||
| 87 | L7 | RA4 | 5V | |||
| 88 | N7 | VDD | ||||
| 89 | K7 | VSS | ||||
| 90 | K8 | RF4 | 5V | |||
| 91 | L8 | RF5 | 5V | |||
| 92 | M8 | RK4 | 5V | |||
| 93 | N8 | RK5 | 5V | |||
| 94 | K9 | RK6 | 5V | |||
| 95 | L9 | RA14 | 5V | |||
| 96 | M9 | RA15 | 5V | |||
| 97 | N9 | RD9 | 5V | |||
| 98 | N10 | RD10 | 5V | |||
| 99 | M10 | RD11 | 5V | |||
| 100 | L10 | RH12 | 5V | |||
| 101 | K11 | RH13 | 5V | |||
| 102 | L11 | RH14 | 5V | |||
| 103 | M11 | RH15 | 5V | |||
| 104 | N11 | RD0 | 5V | |||
| 105 | N12 | RC13 | ||||
| 106 | M12 | RC14 | ||||
| 107 | N13 | VDD | ||||
| 108 | K10 | VSS | ||||
| 109 | M13 | RD1 | 5V | |||
| 110 | L12 | RD2 | 5V | |||
| 111 | L13 | RD3 | 5V | |||
| 112 | K13 | RD12 | 5V | |||
| 113 | K12 | RD13 | 5V | |||
| 114 | J11 | RJ0 | 5V | |||
| 115 | J12 | RJ1 | 5V | |||
| 116 | J13 | RJ2 | 5V | |||
| 117 | H13 | RJ3 | 5V | |||
| 118 | H12 | RD4 | 5V | |||
| 119 | H11 | RD5 | 5V | |||
| 120 | J10 | RD6 | 5V | |||
| 121 | H10 | RD7 | 5V | |||
| 122 | G13 | VDD | ||||
| 123 | G10 | VSS | ||||
| 124 | G12 | RF0 | 5V | |||
| 125 | G11 | RF1 | 5V | |||
| 126 | F10 | RK7 | 5V | |||
| 127 | F11 | RG1 | 5V | |||
| 128 | F12 | RG0 | 5V | |||
| 129 | F13 | RA6 | 5V | |||
| 130 | E13 | RA7 | 5V | |||
| 131 | E12 | RJ4 | 5V | |||
| 132 | E11 | RJ5 | 5V | |||
| 133 | E10 | RJ6 | 5V | |||
| 134 | D11 | RJ7 | 5V | |||
| 135 | D10 | RE0 | 5V | |||
| 136 | D9 | VSS | ||||
| 137 | D13 | VDD | ||||
| 138 | C10 | RE1 | 5V | |||
| 139 | D12 | RG14 | 5V | |||
| 140 | C11 | RG12 | 5V | |||
| 141 | C12 | RG13 | 5V | |||
| 142 | C13 | RE2 | 5V | |||
| 143 | B13 | RE3 | 5V | |||
| 144 | A13 | RE4 | 5V | |||
Tuesday, August 25, 2020
Renaming a KiCad project
I keep my projects in svn, and kicad made it more challenging than I expected to rename a project. The orignal project was igbt-tx, and my new project is tx-3x1. First, you rename the top level project:
for f in igbt-tx*; do svn mv "$f" "$(echo $f | sed 's/^igbt-tx/tx-3x1/g')"; done
You then need update the libraries:
find ./ -type f -exec sed -i 's/igbt-tx/tx-3x1/g' {} \;
If you want to do this without svn, you need to just remove the "svn".
Subscribe to:
Posts (Atom)

