The timing diagram for this type of computer is fairly well known (see here, page 69,70)
Problem is when the bus is read (GPIOB->IDR) via interrupt on *DS (Device Select) RISING the data returned doesn't change when bus data is changed.
Here's the sketch (I’m using the maple boot loader and DFU to load sketches onto the board using Arduino IDE.)
Code: Select all
// Control Signals
#define DS PB3 // *Device Select
#define RW PB4 // Read / Write (Read High, Write Low)
#define BUS01 PB5 // BUS 01 Clock
// Data Bus
#define D0 PB8
#define D1 PB9
#define D2 PB10
#define D3 PB11
#define D4 PB12
#define D5 PB13
#define D6 PB14
#define D7 PB15
// Device Select ISR
void DS_ISR()
{
noInterrupts();
uint32_t value = GPIOB->IDR;
interrupts();
displayBits32(value);
}
void setup()
{
Serial.begin(9600);
pinMode(DS, INPUT);
pinMode(RW, INPUT);
pinMode(BUS01, INPUT);
pinMode(D0, INPUT);
pinMode(D1, INPUT);
pinMode(D2, INPUT);
pinMode(D3, INPUT);
pinMode(D4, INPUT);
pinMode(D5, INPUT);
pinMode(D6, INPUT);
pinMode(D7, INPUT);
attachInterrupt(digitalPinToInterrupt(DS), DS_ISR, RISING);
delay(2000);
Serial.write("Booted 6\n");
}
void loop() {} // nothing
void displayBits32(uint32_t value) {
uint32_t c;
uint32_t displaymask = 1 << 31;
for (c = 1; c <=32; c++) {
if (value & displaymask)
Serial.print('1');
else
Serial.print('0');
value <<= 1;
if (c % 8 == 0)
Serial.print(' ');
}
Serial.write("\n");
}
Serial Output from the sketch. Notice that PB8-15 don't change:
Code: Select all
Booted 6
00000000 00000000 01000000 00011000
00000000 00000000 01000000 00011000
00000000 00000000 01000000 00011000