Skip to content

Commit

Permalink
Si5351 driver working
Browse files Browse the repository at this point in the history
  • Loading branch information
Alistair Jordan committed Dec 1, 2023
1 parent cc3fca3 commit 5e68d1e
Show file tree
Hide file tree
Showing 8 changed files with 116 additions and 3 deletions.
12 changes: 10 additions & 2 deletions docs/WSPR.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ For use the protocol requires an amateur radio license. For this project, I have

## Base Design

### Code

The project is based on [https://github.com/alexf91/WSPR-Beacon/]alexf91/WSPR-Beacon however has been completely rewritten.

The initial code was designed for an Arduino based solution with a USB interface. The re-write disregards the code apart from the WSPR encoding library.
The initial code was designed for an Arduino based solution with a USB interface. The re-write here disregards the code apart from the WSPR encoding library.

A special mention here is [https://github.com/threeme3/WsprryPi]threeme3/WsprryPi. I's not used in this project, but was vastly helpful for design purposes.

### Electronics

The WSPR part of the project requires an oscillator to function at around 14MHz.

A special mention here is [https://github.com/threeme3/WsprryPi]threeme3/WsprryPi
For this it was chosen to use the si5351, for the good community support, and the ease of the i2c interface.
4 changes: 4 additions & 0 deletions sysdrv/cfg/package.mk
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,7 @@ $(eval $(call MACRO_CHECK_ENABLE_PKG, RK_ENABLE_OTA))
# Enable build strace
CONFIG_SYSDRV_ENABLE_STRACE=n
$(eval $(call MACRO_CHECK_ENABLE_PKG, RK_ENABLE_STRACE))

# Enable build WSPR
CONFIG_SYSDRV_ENABLE_WSPR=y
$(eval $(call MACRO_CHECK_ENABLE_PKG, RK_ENABLE_WSPR))
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
regulator-name = "gpio1_pd0";
regulator-always-on;
};

clocks {
/* 25MHz reference crystal */
ref25: ref25M {
compatible = "fixed-clock";
#clock-cells = <0>;
clock-frequency = <25000000>;
};
};
};

&sfc {
Expand Down Expand Up @@ -67,11 +76,69 @@
// status = "disabled";
//};


// /**********I2C**********/
&i2c3 {
status = "okay";
pinctrl-0 = <&i2c3m1_xfer>;
clock-frequency = <100000>;
/* Si5351a msop10 i2c clock generator */
si5351a: clock-generator@60 {
compatible = "silabs,si5351a-msop";
reg = <0x60>;
#address-cells = <1>;
#size-cells = <0>;
#clock-cells = <1>;

/* connect xtal input to 25MHz reference */
clocks = <&ref25>;
clock-names = "xtal";

/* connect xtal input as source of pll0 and pll1 */
silabs,pll-source = <0 0>, <1 0>;

/*
* overwrite clkout0 configuration with:
* - 8mA output drive strength
* - pll0 as clock source of multisynth0
* - multisynth0 as clock source of output divider
* - multisynth0 can change pll0
* - set initial clock frequency of 74.25MHz
*/
clkout0 {
reg = <0>;
silabs,drive-strength = <8>;
silabs,multisynth-source = <0>;
silabs,clock-source = <0>;
silabs,pll-master;
/* clock-frequency = <74250000>;*/
};

/*
* overwrite clkout1 configuration with:
* - 4mA output drive strength
* - pll1 as clock source of multisynth1
* - multisynth1 as clock source of output divider
* - multisynth1 can change pll1
*/
clkout1 {
reg = <1>;
silabs,drive-strength = <4>;
silabs,multisynth-source = <1>;
silabs,clock-source = <0>;
pll-master;
};

/*
* overwrite clkout2 configuration with:
* - xtal as clock source of output divider
*/
clkout2 {
reg = <2>;
silabs,clock-source = <2>;
};
};

};

&pinctrl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,3 +320,4 @@ CONFIG_DEBUG_FS=y
# CONFIG_SCHED_DEBUG is not set
# CONFIG_FTRACE is not set
# CONFIG_RUNTIME_TESTING_MENU is not set
CONFIG_COMMON_CLK_SI5351=y
10 changes: 9 additions & 1 deletion sysdrv/tools/board/Makefile.tools.board.mk
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ tools_board-builds: \
board-build-rockchip_test \
board-build-e2fsprogs \
board-build-sysstat \
board-build-mtd_utils
board-build-mtd_utils \
board-build-wspr
@echo "build tools board done"

tools_board-clean:
Expand All @@ -23,6 +24,7 @@ tools_board-clean:
$(MAKE) -C $(SYSDRV_DIR)/tools/board/stressapptest distclean
$(MAKE) -C $(SYSDRV_DIR)/tools/board/rk_ota distclean
$(MAKE) -C $(SYSDRV_DIR)/tools/board/sysstat distclean
$(MAKE) -C $(SYSDRV_DIR)/tools/board/wspr distclean

board-build-toolkits:
$(MAKE) -C $(SYSDRV_DIR)/tools/board/toolkits
Expand Down Expand Up @@ -74,7 +76,13 @@ ifeq ($(BOOT_MEDIUM),spi_nor)
popd;
endif
endif

board-build-sysstat:
ifeq ($(ENABLE_SYSSTAT),y)
$(MAKE) -C $(SYSDRV_DIR)/tools/board/sysstat
endif

board-build-wspr:
ifeq ($(ENABLE_WSPR),y)
$(MAKE) -C $(SYSDRV_DIR)/tools/board/wspr
endif
25 changes: 25 additions & 0 deletions sysdrv/tools/board/wspr/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

#ifeq ($(SYSDRV_PARAM), )
# SYSDRV_PARAM:=../../../Makefile.param
# include $(SYSDRV_PARAM)
#endif

export LC_ALL=C
SHELL:=/bin/bash

CURRENT_DIR := $(shell pwd)
PKG_NAME := wspr
PKG_BIN := out

all:
@test -f $(PKG_BIN)/usr/sbin/$(PKG_NAME) || (\
mkdir -p $(CURRENT_DIR)/$(PKG_BIN)/usr/sbin; \
gcc main.c wspr.c -o $(CURRENT_DIR)/$(PKG_BIN)/usr/sbin/$(PKG_NAME); \
)
$(call MAROC_COPY_PKG_TO_SYSDRV_OUTPUT, $(SYSDRV_DIR_OUT_ROOTFS), $(PKG_BIN))

clean: distclean

distclean:
-rm -rf $(PKG_NAME) $(PKG_BIN)

Binary file modified sysdrv/tools/board/wspr/main
Binary file not shown.
Empty file.

0 comments on commit 5e68d1e

Please sign in to comment.