Skip to content

Commit

Permalink
Very early initial support for RPi 5 based on dev branch of circle. (#…
Browse files Browse the repository at this point in the history
…638)

* Very early initial support for RPi 5 based on dev branch of circle.

* Added parameter to choose UART option on all RPi versions to be GP14/15

* Build for Raspberry Pi 5

* Update README.md for RPi 5

---------

Co-authored-by: probonopd <[email protected]>
  • Loading branch information
diyelectromusic and probonopd authored Apr 17, 2024
1 parent 349100d commit 75eb763
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 5 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ jobs:
wget -q https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-arm-none-eabi.tar.xz
tar xf *-arm-none-eabi.tar.xz
mkdir -p kernels
- name: Build for Raspberry Pi 5
run: |
set -ex
export PATH=$(readlink -f ./gcc-*aarch64-none*/bin/):$PATH
RPI=5 bash -ex build.sh
cp ./src/kernel*.img ./kernels/
- name: Build for Raspberry Pi 4
run: |
set -ex
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ Video about this project by [Floyd Steinberg](https://www.youtube.com/watch?v=Z3

## System Requirements

- Raspberry Pi 1, 2, 3, 4, or 400 (Zero and Zero 2 can be used but need HDMI or a supported i2s DAC for audio out). On Raspberry Pi 1 and on Raspberry Pi Zero there will be severely limited functionality (only one tone generator instead of 8)
- Raspberry Pi 1, 2, 3, 4, or 400. Raspberry Pi Zero and Zero 2 can be used but need HDMI or a supported i2s DAC for audio out. On Raspberry Pi 1 and on Raspberry Pi Zero there will be severely limited functionality (only one tone generator instead of 8)
- Raspberry Pi 5 can be used but currently support is experimental; HDMI sound and USB Gadget mode are not available yet
- A [PCM5102A or PCM5122 based DAC](https://github.com/probonopd/MiniDexed/wiki/Hardware#i2s-dac), HDMI display or [audio extractor](https://github.com/probonopd/MiniDexed/wiki/Hardware#hdmi-to-audio) for good sound quality. If you don't have this, you can use the headphone jack on the Raspberry Pi but on anything but the Raspberry 4 the sound quality will be seriously limited
- Optionally (but highly recommended), an [LCDC1602 Display](https://www.berrybase.de/en/sensors-modules/displays/alphanumeric-displays/alphanumerisches-lcd-16x2-gr-252-n/gelb) (with or without i2c "backpack" board) and a [KY-040 rotary encoder](https://www.berrybase.de/en/components/passive-components/potentiometer/rotary-encoder/drehregler/rotary-encoder-mit-breakoutboard-ohne-gewinde-und-mutter)

Expand Down
6 changes: 5 additions & 1 deletion src/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ gpu_mem=16
disable_overscan=0

#
# Use 64-bit for RPi 3, 4, 400 and Zero 2, and 32-bit for all other models
# Use 64-bit for RPi 3, 4, 400, 5 and Zero 2, and 32-bit for all other models
#

[pi3]
Expand All @@ -24,3 +24,7 @@ kernel=kernel8-rpi4.img
# Zero 2 W
[pi02]
arm_64bit=1

[pi5]
arm_64bit=1
kernel=kernel_2712.img
4 changes: 4 additions & 0 deletions src/kernel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,12 @@ bool CKernel::Initialize (void)

if (m_Config.GetUSBGadgetMode())
{
#if RASPPI==5
#warning No support for USB Gadget Mode on RPI 5 yet
#else
// Run the USB stack in USB Gadget (device) mode
m_pUSB = new CUSBMiniDexedMIDIGadget (&mInterrupt);
#endif
}
else
{
Expand Down
8 changes: 8 additions & 0 deletions src/minidexed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,11 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt,

if (pConfig->GetUSBGadgetMode())
{
#if RASPPI==5
LOGNOTE ("USB Gadget (Device) Mode NOT supported on RPI 5");
#else
LOGNOTE ("USB In Gadget (Device) Mode");
#endif
}
else
{
Expand All @@ -128,6 +132,9 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt,
}
else if (strcmp (pDeviceName, "hdmi") == 0)
{
#if RASPPI==5
LOGNOTE ("HDMI mode NOT supported on RPI 5.");
#else
LOGNOTE ("HDMI mode");

m_pSoundDevice = new CHDMISoundBaseDevice (pInterrupt, pConfig->GetSampleRate (),
Expand All @@ -136,6 +143,7 @@ CMiniDexed::CMiniDexed (CConfig *pConfig, CInterruptSystem *pInterrupt,
// The channels are swapped by default in the HDMI sound driver.
// TODO: Remove this line, when this has been fixed in the driver.
m_bChannelsSwapped = !m_bChannelsSwapped;
#endif
}
else
{
Expand Down
6 changes: 5 additions & 1 deletion src/serialmididevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@

LOGMODULE("serialmididevice");

// There are several UART options - see circle/include/serial.h
// 0 corresponds to GP14/GP15 on all RPi versions.
#define SERIAL_MIDI_DEVICE 0

CSerialMIDIDevice::CSerialMIDIDevice (CMiniDexed *pSynthesizer, CInterruptSystem *pInterrupt,
CConfig *pConfig, CUserInterface *pUI)
: CMIDIDevice (pSynthesizer, pConfig, pUI),
m_pConfig (pConfig),
m_Serial (pInterrupt, TRUE),
m_Serial (pInterrupt, TRUE, SERIAL_MIDI_DEVICE),
m_nSerialState (0),
m_nSysEx (0),
m_SendBuffer (&m_Serial)
Expand Down
18 changes: 18 additions & 0 deletions src/usbminidexedmidigadget.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@
#ifndef _usbminidexedmidigadget_h
#define _usbminidexedmidigadget_h

#if RASPPI==5
#include <circle/sysconfig.h>
#include <assert.h>

#warning No support for USB Gadget Mode on RPI 5 yet
class CUSBMiniDexedMIDIGadget
{
public:
CUSBMiniDexedMIDIGadget (CInterruptSystem *pInterruptSystem)
{
}

~CUSBMiniDexedMIDIGadget (void)
{
}
};
#else
#include <circle/usb/gadget/usbmidigadget.h>
#include <circle/usb/gadget/usbmidigadgetendpoint.h>
#include <circle/sysconfig.h>
Expand Down Expand Up @@ -82,5 +99,6 @@ class CUSBMiniDexedMIDIGadget : public CUSBMIDIGadget
return CUSBMIDIGadget::GetDescriptor(wValue, wIndex, pLength);
}
};
#endif

#endif
4 changes: 2 additions & 2 deletions submod.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ git submodule update --init --recursive
#
# Use fixed master branch of circle-stdlib then re-update
cd circle-stdlib/
git checkout 695ab4a
git checkout 3bd135d
git submodule update --init --recursive
cd -
#
# Optional update submodules explicitly
cd circle-stdlib/libs/circle
git checkout fe09c4b
git checkout 4b3e06f
cd -
cd circle-stdlib/libs/circle-newlib
#git checkout develop
Expand Down

0 comments on commit 75eb763

Please sign in to comment.