Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@

case/.DS_Store
.DS_Store

*.FCBak
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,17 @@ original Tetris, or do some die-hard computing on 2.11BSD.

Well, someone had to put back the 'mini' in 'minicomputer', right?

---

This fork contains a set of patches to correct build errors in IDF 5.0
Ian Schofield (Isysxp)
October 2023

---

This fork integrates the sunton ESP32 2832S028 board. I try to do this in a way it simplifys the integration of other boards.
Patched for IDF 5.2.1

SvenMb
April 2024

File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
25 changes: 25 additions & 0 deletions boards/Sunton_2832S028/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Sunton ESP32 2832S028

The Sunton ESP32 2832S028 is avaiable for very cheap and integrates most of the needed hardware to run this PDP11 emulator.
Unfortunately they decided not to include PSRAM, so we have to add it to the board. But it is not that complicated.

I only have the newer version of this board with a ST7789 display, so you are are bit on yourself if you want to use the
older version with ILI9341, since the board layout changed.

## Modifications

Board before modification:
![pre modification](pre.png)

You have to remove the RGB-led and cut two lines:
![LED removal and lines cut](led_removed_lines_cutted.png)

Now you can solder the PSRAM chip and add lines to the IO16, IO17 exposed on the former led place. Also add 10k pull-up as you can see here:
![post modification](post.png)

## flash firmware

after flashing the firmware and inserting the sdcard with the harddrive image, BSD 2.11 will boot:
![in use](in_use.png)


Binary file added boards/Sunton_2832S028/case/2432S028.FCStd
Binary file not shown.
Binary file added boards/Sunton_2832S028/case/2432S028_Bezel.FCStd
Binary file not shown.
Binary file added boards/Sunton_2832S028/case/2432S028_Bezel.stl
Binary file not shown.
Binary file added boards/Sunton_2832S028/case/2432S028_Pin_Boot.stl
Binary file not shown.
Binary file not shown.
Binary file added boards/Sunton_2832S028/case/2432S028_USB.stl
Binary file not shown.
Binary file added boards/Sunton_2832S028/case/2432S028_inner.FCStd
Binary file not shown.
Binary file added boards/Sunton_2832S028/case/2432S028_inner.stl
Binary file not shown.
Binary file not shown.
Binary file added boards/Sunton_2832S028/case/2432S028_outer.stl
Binary file not shown.
Binary file added boards/Sunton_2832S028/case/2432S028_pins.FCStd
Binary file not shown.
Binary file added boards/Sunton_2832S028/case/MicroSD_2432S028.stl
Binary file not shown.
Binary file added boards/Sunton_2832S028/in_use.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added boards/Sunton_2832S028/post.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added boards/Sunton_2832S028/pre.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions firmware/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
build/
*~
*old
3 changes: 3 additions & 0 deletions firmware/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ cmake_minimum_required(VERSION 3.5)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(esppdp)
spiffs_create_partition_image(storage spiffs/ FLASH_IN_PROJECT)
set_target_properties(${COMPONENT_LIB} PROPERTIES COMPILE_FLAGS -Wformat=n)
idf_build_set_property(COMPILE_OPTIONS "-Wno-error" APPEND)

4 changes: 3 additions & 1 deletion firmware/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ BT device afterwards will be detected automatically. Unfortunately there's no ea
the pairing to use a different keyboard without erasing the flash of the ESP32 (idf.py erase-flash).

This firmware works on either the final hardware (as detailed in the ../pcb directory) as well
as a standard ESP32-Wrover-Kit development board + LCD. You can configure which board to run on
as a standard ESP32-Wrover-Kit development board + LCD and a modified Sunton 2432S028 board. You can configure which board to run on
in menuconfig. (If your LCDs backlight doesn't turn on, you selected the wrong one.)

The firmware embeds a floppy disk containing RTX-11 as well as Tetris, and will start this up
Expand All @@ -22,3 +22,5 @@ from uploading the Tetris floppy every time.
This firmware is developed on the current (11 jan 2021) master branch of ESP-IDF, but will likely
compile on ESP-IDF 4.2 and possibly other versions.

As of April 2024 it is patched for latest ESP-IDF 5.2.1 and compiles with that.

4 changes: 4 additions & 0 deletions firmware/components/boards/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

idf_component_register( ..
INCLUDE_DIRS "." )

37 changes: 37 additions & 0 deletions firmware/components/boards/hw_2432S028.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// HW definition for Sunton 2432S028
// Sven Muehlberg


#define ESP32_2432S028R

#define DISPLAY_WIDTH 240
#define DISPLAY_HEIGHT 320
#define DISPLAY_CHW 4
#define DISPLAY_CHH 10
#define DISPLAY_BCKL 21
#define DISPLAY_BCKL_ON 1
#define DISPLAY_BCKL_OFF 0
#define DISPLAY_INVERT 0
#define DISPLAY_ROTATE 1

#define DISPLAY_SPI
#define DISPLAY_SPI_HOST HSPI_HOST
#define DISPLAY_SPI_DMA SPI_DMA_CH2
#define DISPLAY_SPI_MODE 0
#define DISPLAY_SPI_MISO GPIO_NUM_NC
#define DISPLAY_SPI_MOSI 13
#define DISPLAY_SPI_SCLK 14
#define DISPLAY_SPI_CS 15
#define DISPLAY_SPI_DC 2
#define DISPLAY_SPI_RST GPIO_NUM_NC
#define DISPLAY_SPI_HZ 24000000

#define SD_SPI
#define SD_SPI_HOST SPI3_HOST
#define SD_SPI_DMA SPI_DMA_CH1
#define SD_SPI_CS 5
#define SD_SPI_MOSI 23
#define SD_SPI_SCLK 18
#define SD_SPI_MISO 19

// #define SD_NONE
34 changes: 34 additions & 0 deletions firmware/components/boards/hw_final.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// HW definition for Jeroens final hardware
// Sven Muehlberg


#define ESP32_FINAL

#define DISPLAY_WIDTH 240
#define DISPLAY_HEIGHT 320
#define DISPLAY_CHW 4
#define DISPLAY_CHH 10
#define DISPLAY_BCKL 5
#define DISPLAY_BCKL_ON 1
#define DISPLAY_BCKL_OFF 0
#define DISPLAY_ID 1
#define DISPLAY_INVERT 1

#define DISPLAY_SPI
#define DISPLAY_SPI_HOST HSPI_HOST
#define DISPLAY_SPI_DMA SPI_DMA_CH2
#define DISPLAY_SPI_MODE 0
#define DISPLAY_SPI_MISO GPIO_NUM_NC
#define DISPLAY_SPI_MOSI 23
#define DISPLAY_SPI_SCLK 19
#define DISPLAY_SPI_CS 22
#define DISPLAY_SPI_DC 21
#define DISPLAY_SPI_RST GPIO_NUM_NC
#define DISPLAY_SPI_HZ 24000000

#define SD_MMC
#define SD_MMC_CMD 15
#define SD_MMC_D0 2
#define SD_MMC_D1 4
#define SD_MMC_D2 12
#define SD_MMC_D3 13
44 changes: 44 additions & 0 deletions firmware/components/boards/hw_wrover.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// HW definition for Jeroens wrover based hardware
// Sven Muehlberg


#define ESP32_WROVER

#define DISPLAY_WIDTH 240
#define DISPLAY_HEIGHT 320
#define DISPLAY_CHW 4
#define DISPLAY_CHH 10
#define DISPLAY_BCKL 5
#define DISPLAY_BCKL_ON 0
#define DISPLAY_BCKL_OFF 1
// #define DISPLAY_ID 1
#define DISPLAY_INVERT 0

#define DISPLAY_SPI
#define DISPLAY_SPI_HOST HSPI_HOST
#define DISPLAY_SPI_DMA SPI_DMA_CH2
#define DISPLAY_SPI_MODE 0
#define DISPLAY_SPI_MISO GPIO_NUM_NC
#define DISPLAY_SPI_MOSI 23
#define DISPLAY_SPI_SCLK 19
#define DISPLAY_SPI_CS 22
#define DISPLAY_SPI_DC 21
#define DISPLAY_SPI_RST GPIO_NUM_NC
#define DISPLAY_SPI_HZ 24000000

// #define SD_SPI
// #define SD_SPI_HOST SPI3_HOST
// #define SD_SPI_DMA SPI_DMA_CH1
// #define SD_SPI_CS 5
// #define SD_SPI_MOSI 23
// #define SD_SPI_SCLK 18
// #define SD_SPI_MISO 19

#define SD_MMC
#define SD_MMC_CMD 15
#define SD_MMC_D0 2
#define SD_MMC_D1 4
#define SD_MMC_D2 12
#define SD_MMC_D3 13

// #define SD_NONE
2 changes: 1 addition & 1 deletion firmware/components/hid_server/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

idf_component_register(SRCS "hci_server.cpp" "hci_transport_esp32.cpp" "hid_server.cpp"
REQUIRES bt
INCLUDE_DIRS ".")
INCLUDE_DIRS "." $ENV{IDF_PATH}/components/nvs_flash/include )

38 changes: 21 additions & 17 deletions firmware/components/hid_server/hci_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ using namespace std;
#define PRINTF(...)
#endif

#include "esp_log.h"
#define TAG "hci_server"


#define HCI_GRP_LINK_CONT_CMDS (0x01 << 10) // 0x0400
#define HCI_GRP_LINK_POLICY_CMDS (0x02 << 10) // 0x0800
#define HCI_GRP_HOST_CONT_BASEBAND_CMDS (0x03 << 10) // 0x0C00
Expand Down Expand Up @@ -509,7 +513,7 @@ class BTDevice {
// this will happen before hid knows about it
void hci_connected(const connection_info* ci)
{
PRINTF("%s connected on handle %d\n",batostr(ci->bdaddr),ci->handle);
ESP_LOGI(TAG,"%s connected on handle %d\n",batostr(ci->bdaddr),ci->handle);
_handle = ci->handle;
}

Expand Down Expand Up @@ -575,7 +579,7 @@ class BTDevice {

void control(const l2cap_cmd* c)
{
PRINTF("acl recv:%d %s %d:%d:%d:%d len:%d\n",c->id,L2CAP_ComandCodeStr(c->cmd),
ESP_LOGI(TAG,"acl recv:%d %s %d:%d:%d:%d len:%d\n",c->id,L2CAP_ComandCodeStr(c->cmd),
c->params[0],c->params[1],c->params[2],c->params[3],c->cmdLength);

_txid++; // TODO. advance _txid on recev?
Expand All @@ -596,7 +600,7 @@ class BTDevice {
if (status != 1) {
if (s)
s->set_state(L2CAP_CLOSED);
PRINTF("l2cap connection FAILED: %d\n",status);
ESP_LOGE(TAG,"l2cap connection FAILED: %d\n",status);
}
}
}
Expand Down Expand Up @@ -663,7 +667,7 @@ class BTDevice {
break;

default:
PRINTF("%02X l2cap weird %d %s\n",c->cmd,c->cmdLength,L2CAP_ComandCodeStr(c->cmd));
ESP_LOGI(TAG,"%02X l2cap weird %d %s\n",c->cmd,c->cmdLength,L2CAP_ComandCodeStr(c->cmd));
}
}

Expand All @@ -685,7 +689,7 @@ class BTDevice {

int l2cap(uint8_t cmd, uint8_t id, u16* params, int count)
{
PRINTF("acl send:%d %s\n",id,L2CAP_ComandCodeStr(cmd));
ESP_LOGI(TAG,"acl send:%d %s\n",id,L2CAP_ComandCodeStr(cmd));
l2cap_cmd b;
b.cmd = cmd;
b.id = id;
Expand Down Expand Up @@ -854,7 +858,7 @@ class HCI {
{
_hci = hci_open();
if (!_hci)
PRINTF("hci_open failed\n");
ESP_LOGI(TAG,"hci_open failed\n");
else {
hci_set_packet_handler(_hci,packet_,this);
hci_set_ready_to_send_handler(_hci,ready_to_send_,this);
Expand Down Expand Up @@ -882,11 +886,11 @@ class HCI {
static void trace(int dir, const uint8_t* data, int len)
{
static const char *tagnames[5] = { "???", "CMD", "ACL", "ISO", "EVT" };
fprintf(stdout,"%c %s ",dir ? '>' : '<',tagnames[*data++]);
ESP_LOGI(TAG,"%c %s ",dir ? '>' : '<',tagnames[*data++]);
len--;
for (int i = 0; i < len; i++)
fprintf(stdout,"%02X",data[i]);
fprintf(stdout,"\n");
ESP_LOGI(TAG,"%02X",data[i]);
ESP_LOGI(TAG,"\n");
}

int update()
Expand All @@ -907,7 +911,7 @@ class HCI {
case 0x2: acl(&buf[0],(int)buf.size()); break;
case 0x4: hci(buf[1],&buf[3],buf[2]); break;
default:
PRINTF("bad hci packet\n");
ESP_LOGE(TAG,"bad hci packet\n");
}
}
return 0;
Expand Down Expand Up @@ -1024,7 +1028,7 @@ class HCI {
auto* d = get_device(&ri->bdaddr);
if (d) {
d->_name = ri->name;
PRINTF("remote_name_response %s %s\n",batostr(ri->bdaddr),ri->name);
ESP_LOGI(TAG,"remote_name_response %s %s\n",batostr(ri->bdaddr),ri->name);
}
return d;
}
Expand Down Expand Up @@ -1134,7 +1138,7 @@ class HCI {
//uint16_t buf[1] = {(uint16_t)d->_handle};
//cmd(HCI_AUTHENTICATION_REQUESTED,buf,sizeof(buf)); // ask for auth
} else {
PRINTF("hci connection failed: %s\n",hci_status_str(c->status));
ESP_LOGE(TAG,"hci connection failed: %s\n",hci_status_str(c->status));
d->_handle = -1;
}
}
Expand Down Expand Up @@ -1169,7 +1173,7 @@ class HCI {

void hci(uint8_t evt, const uint8_t* data, uint8_t len)
{
PRINTF("%s %d bytes\n",hci_evt(evt),len);
ESP_LOGI(TAG,"%s %d bytes\n",hci_evt(evt),len);
switch (evt) {
case HCI_INQUIRY_COMP_EVT:
_state &= ~MASK_INQUIRY;
Expand Down Expand Up @@ -1263,7 +1267,7 @@ class HCI {
{
int c = data[1] | (data[2] << 8);
int status = data[3];
PRINTF(" -> %s %04X %s\n",hci_cmd(c),c,hci_status_str(status));
ESP_LOGI(TAG," -> %s %04X %s\n",hci_cmd(c),c,hci_status_str(status));
switch (c) {
// Init phase 0
case HCI_RESET:
Expand Down Expand Up @@ -1336,7 +1340,7 @@ class HCI {
case HCI_COMMAND_STATUS_EVT: // after starting inquiry/connect etc
{
int cmd = data[2] + (data[3] << 8);
PRINTF(" -> %s %04X %s\n",hci_cmd(cmd),cmd,hci_status_str(data[0]));
ESP_LOGI(TAG," -> %s %04X %s\n",hci_cmd(cmd),cmd,hci_status_str(data[0]));
}
break;
case HCI_QOS_SETUP_COMP_EVT:
Expand All @@ -1353,7 +1357,7 @@ class HCI {
write_link_key((const bdaddr_t*)data,data+6);
break;
default:
PRINTF("unhandled hci case\n");
ESP_LOGE(TAG,"unhandled hci case\n");
}
}

Expand Down Expand Up @@ -1381,7 +1385,7 @@ class HCI {
// interesting bug on libusb/simulator where ACL open packet arrives before hci connection complete
// hci arrives on libusb_fill_interrupt_transfer, acl on libusb_fill_bulk_transfer but acl gets ahead

PRINTF("ACL PACKET DROPPED! handle %d, %d bytes\n",h,len);
ESP_LOGE(TAG,"ACL PACKET DROPPED! handle %d, %d bytes\n",h,len);
_dongle_bug.resize(len);
memcpy(&_dongle_bug[0],data,len);
}
Expand Down
Loading