Per Mårtensson 2 ani în urmă
părinte
comite
7acf83b7bd

+ 3 - 4
sw/include/blacksasi.h

@@ -10,8 +10,6 @@
 
 #define LOG_FILENAME "LOG.txt"
 
-#define SPI_CLOCK SD_SCK_MHZ(50)
-
 #define DEBUG            1      // 0:No debug information output
                                 // 1: Debug information output to USB Serial
                                 // 2: Debug information output to LOG.txt (slow)
@@ -19,10 +17,11 @@
 #define SCSI_SELECT      0      // 0 for STANDARD
                                 // 1 for SHARP X1turbo
                                 // 2 for NEC PC98
+/*
 #define READ_SPEED_OPTIMIZE  1 // Faster reads
 #define WRITE_SPEED_OPTIMIZE 1 // Speeding up writes
 #define USE_DB2ID_TABLE      1 // Use table to get ID from SEL-DB
-
+*/
 // SCSI config
 #define NUM_SCSIID  7          // Maximum number of supported SCSI-IDs (The minimum is 0)
 #define NUM_SCSILUN 2          // Maximum number of LUNs supported     (The minimum is 0)
@@ -237,7 +236,7 @@ static const uint32_t scsiDbInputOutputPullAnd_PDREG  = 0b0000000000000001010101
 // Control pins
 //                                                         5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 
 static const uint32_t scsiDbInputOutputPullAnd_PEREG  = 0b00000000000000000001010101010001;
-static const uint32_t scsiDbInputOutputPullAnd_PBREG  = 0b00010000000000000101000000000000;
+static const uint32_t scsiDbInputOutputPullAnd_PBREG  = 0b00010001000100000101000000000000;
 // Put DB and DP in output mode and control buffers
 #define SCSI_DB_OUTPUT() { PDREG->MODER = (PDREG->MODER & scsiDbInputOutputAnd_PDREG) | scsiDbOutputRegOr_PDREG;  SCSI_DATABUS_OUT() ;}
 

+ 5 - 1
sw/platformio.ini

@@ -11,7 +11,7 @@
 [env:blacksasi_f411]
 platform = ststm32
 board = blacksasi_f411m
-board_build.f_cpu = 960000000L
+
 ;board.variants_dir = /home/pm/project/stm32/BlackSASI/sw/variant/blacksasi_f411m
 
 board.variants_dir = C:\Users\martenssonp\projects\BlackSASI\sw\variant\blacksasi_f411m
@@ -20,6 +20,7 @@ board_build.core = maple
 lib_deps =
   greiman/SdFat@^2.2.0
   bblanchon/ArduinoJson @ ^6.19.3
+  ;https://github.com/ZulNs/STM32F1_RTC#master
 upload_protocol = stlink
 debug_tool = stlink
 ; Different gcc versions produce much different binaries in terms of speed.
@@ -42,6 +43,8 @@ build_flags =
     -DARDUINO_LIB_DISCOVERY_PHASE
     -DARDUINO=10813
     -DARDUINO_ARCH_STM32
+    -DDEBUG_LEVEL=DEBUG_NONE
+    -D BUILD_TAGS="\"-USB-96MHz\""
     -O2
     -DSERIAL_USB
     -DCRYSTAL_FREQ=25
@@ -54,6 +57,7 @@ build_flags =
     -DUSB_PRODUCT="\"BLACKSASI_F411\""
     -DHAL_PCD_MODULE_ENABLED
     -D USBD_USE_CDC
+    -DBOARD_RCC_PLLMUL=RCC_PLLMUL_12
 
 ; [env:debug]
 ; build_type = debug

+ 4 - 4
sw/src/gpio.cpp

@@ -16,6 +16,8 @@ bool gpioInit(void){
     pinMode(BOARD_REV_PIN0, INPUT_PULLDOWN); 
     pinMode(BOARD_REV_PIN1, INPUT_PULLDOWN);
     pinMode(BOARD_REV_PIN2, INPUT_PULLDOWN);
+    pinMode(BOARD_SDIO_D1, INPUT_PULLDOWN);
+    pinMode(BOARD_SDIO_D2, INPUT_PULLDOWN);
     pinMode(BOARD_SCSI_TERM_HIGH, OUTPUT);
     pinMode(BOARD_SCSI_TERM_LOW, OUTPUT);
     pinMode(BOARD_SCSI_DBX, OUTPUT);
@@ -32,10 +34,8 @@ bool gpioInit(void){
     pinMode(BOARD_SCSI_IND, OUTPUT);
     pinMode(BOARD_SCSI_TAD, OUTPUT);
     pinMode(BOARD_TRANS_OE, OUTPUT);
-pinMode(PB8, OUTPUT);
-pinMode(PB9, OUTPUT);
-digitalWrite(PB8, LOW);
-digitalWrite(PB9, LOW);
+    digitalWrite(BOARD_SCSI_TERM_HIGH, LOW);
+    digitalWrite(BOARD_SCSI_TERM_LOW, LOW);
     digitalWrite(BOARD_TRANS_OE, LOW);
     SCSI_SET_PULL() ;
     TRANSCEIVER_IO_SET(vDTD,DB_INPUT);

+ 4 - 4
sw/src/main.cpp

@@ -43,7 +43,7 @@
 #include <setjmp.h>
 #include <libmaple/exti.h>
 
-#define DEBUG            0      // 0:No debug information output
+#define DEBUG            1      // 0:No debug information output
                                 // 1: Debug information output to USB Serial
                                 // 2: Debug information output to LOG.txt (slow)
 
@@ -926,10 +926,10 @@ void loop()
   // Precaution against bugs or jumps which don't clean up properly
   SCSI_DB_INPUT();
   TRANSCEIVER_IO_SET(vDTD,DB_INPUT)
+  SCSI_TARGET_INACTIVE();
   TRANSCEIVER_IO_SET(vIND,TR_INPUT)
-    SCSI_TARGET_INACTIVE();
-    SCSI_OUT(vACK,inactive);
-    SCSI_SET_PULL();
+  SCSI_OUT(vACK,inactive);
+  SCSI_SET_PULL();
   //pinMode(vBSY,INPUT_PULLUP);
   // Reset target state bits (BSY, MSG, CD, REQ, IO)
   GPIOE->regs->BSRR = 0x00000074; // MSG, CD, REQ, IO

+ 1 - 1
sw/variant/blacksasi_f411m/blacksasi_f411m.h

@@ -35,7 +35,7 @@
 
 #define Port2Pin(port, bit) ((port-'A')*16+bit)
 
-#define CLOCK_SPEED_MHZ  96
+#define CLOCK_SPEED_MHZ  100
 
 /*****************************************************************************/
 // Board pin definitions