Skip to content

Instantly share code, notes, and snippets.


Wojciech Kaczmarski sp5wwp

View GitHub Profile
sp5wwp / AT86RF215_funcs.c
Last active May 19, 2023 11:46
A bunch of functions for AT86RF215 control
View AT86RF215_funcs.c
void AT86_Write(const uint16_t addr, const uint8_t val)
uint8_t tx[3]={(addr>>8)|(1<<7), addr&0xFF, val}; //write enable
HAL_SPI_Transmit(&hspi1, tx, 3, 1);
sp5wwp /
Last active February 27, 2023 14:27
GHDL/VHDL testbench generator
if [ "$#" -lt 1 ]; then
echo "Not enough parameters."
mkdir $1
cd $1
sp5wwp / wm8960_dac_init.c
Created December 13, 2022 14:55
WM8960 slave DAC init
View wm8960_dac_init.c
WM8960_Write(0x0F, 0x1FF); delay_ms(250); //reset
WM8960_Write(0x34, 0x018); //PLL prescale=2
WM8960_Write(0x04, 0x3B1); //clocking
//WM8960_Write(0x07, (1<<1)); //16-bit, I2S format
WM8960_Write(0x07, (1<<0)); //16-bit, left justified MSB first format
sp5wwp / i2s_sample.vhdl
Created December 13, 2022 14:50
I2S sample source - 1kHz sinewave
View i2s_sample.vhdl
--I2S sample source - 1kHz sinewave
--8kHz, 16-bit, left-aligned, MSB first
--clk - 12MHz input clock
--i2s_clk - 400kHz main clock
--lr_clk - 8kHz channel clock
--outp - data output
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
sp5wwp / interpolate.c
Created November 16, 2022 15:23
24->48kSa/s interpolator
View interpolate.c
* M17 baseband interpolator
* Wojciech Kaczmarski SP5WWP
* M17 Project, Nov 2022
#include <stdio.h>
#include <stdint.h>
#include <unistd.h>
View rNyquistM.m
% root-Nyquist (M) filter design %
% Source: %
% %
% Edited by Wojciech SP5WWP to work with rcosdesign() %
% %
% parameters: %
% N: filter order (filter length = N+1) %
% M: number of samples per symbol period %
% alpha: rolloff factor (range 0 to 1) %
sp5wwp / M17_BER.m
Last active October 27, 2022 10:06
View M17_BER.m
clear; clc;
G1=23; %G_1 polynomial in octal notation
G2=35; %G_2 -//-
K=5; %convolutional encoder constraint length
symbols=10000; %test message length in symbols
depth=11; %bit resolution of the soft decoder
head=20; %run-up for the root-nyquist filter in symbols
span=8; %rnyq filter span
sps=10; %samples per symbol
sp5wwp / CC1200_M17_sample.c
Created July 23, 2022 10:04
Sample CC1200 code (running on Nucleo F303RE for Module17 to CC1200 eval board interfacing)
View CC1200_M17_sample.c
const uint8_t cc1200_tx_settings[50*3] =
0x00, 0x01, 0x08,
0x00, 0x03, 0x09,
0x00, 0x08, 0x1F,
0x00, 0x0A, 0xC8, //deviation (for RX can be set to lower value like 0x9F)
0x00, 0x0B, 0x00,
0x00, 0x0C, 0x5D,
0x00, 0x0D, 0x00,
sp5wwp /
Created July 5, 2022 11:25
Saleh model GNU Radio python block
Embedded Python Blocks:
Each time this file is saved, GRC will instantiate the first class it finds
to get ports and parameters of your block. The arguments to __init__ will
be the parameters. All of them are required to have default values!
import numpy as np
from gnuradio import gr