Trouble with STLINK and Crashplan

I where playing with a stm32 discovery board on linux. I got the tool-chain installed and the stlink upload software.
I got the error “bind: Address already in use”.

After some looking around I found that st-link uses port 4242. As it happens crash plan which I use for backup, uses the same port. Luckily this where simple to change in crashplan.

Fermat spirals

The golden ratio is a number often seen in nature. It is often seen in spirals. You can see these in the sunflower. The pattern found in a sunflower was described by Vogel in 1979. He described it as a Fermat spiral. It has the simple formula with polar coordinates:

r(n) = \sqrt{n}
\theta(n)= n\varphi _0

Where \varphi _0 is the golden angle. It can be defined as in degrees as \frac{360}{\varphi ^2},  where \varphi is the golden ratio. That equals about 137.5°.  I wrote a simple python script to plot the function. The blue lines is the connection between consecutive. We see that the connection pattern is quite messy. So this would be a bad way to connect all the squares.


A much better way of connecting them is to follow the spirals. In the image above you can see a couple of spirals. The easiest to spot is perhaps the one with 21 arms. All the spirals you can find will have a Fibonacci number of arms.

To work out the formula for each arm takes a bit more work. First lets define the angle between two consecutive points on one arm. Note her that we want θ to be between π and -π . To do this I use the modulo operator. This works for  21, but not for 34. For 34 you have to subtract an additional 2π.

\theta _s = (21 \varphi _0) \mod 2\pi = \frac{42 \pi}{\varphi _0 ^2}- 16\pi

We can now set up an equation for the theta of the arm equation. Where k is the starting point of the spiral. Here I work with 21 spirals, so k is between 1 and 21. The first point in the spiral is n = 0.
\theta= k\varphi _0 + n\theta_s
Now we use the same idea for the r varable. We will then get
r = \sqrt{k+21n}
Now if we solve theta for n, and substitute it in r we finally get
r(\theta) = \sqrt{k + 21 \frac{\theta - k\varphi _0}{\theta _s}}


As the figure shows, the spirals are now clearly defined. This is probably the best way to connect point in such a pattern. The next spiral up, would have 34 arms. This spiral will go the other way around.

Sunflowers and Fibonacci: Models of Efficiency