もっと今更、SC-88ProにS/PDIFを付けよう

Dependencies:   mbed

もっと今更、SC-88ProにS/PDIFを付けよう

STM32F103C8T6 ARM STM32 (blue pill)

  • モデル:STM32F103C8T6
  • コア:ARM 32 Cortex-M3 CPU
  • 72MHz頻度を作動させる
  • 64Kフラッシュメモリ、20K SRAM
  • 2.0-3.6Vパワー、I/O

というやつ。

/media/uploads/peu605/frontview.jpg

詳細はwikiの説明に

https://developer.mbed.org/users/peu605/code/DIT88proSTM32F1/wiki/説明

しまったなぁ、wikiのタイトル、漢字にしてしまったよ…

STM32F103C8T6, Roland, SC-88pro, S/PDIF, SPIDF, デジタル出力

Revision:
7:f3536af611e6
Parent:
6:669e7d1eac35
Child:
8:3e913d0c7b67
--- a/main.cpp	Wed Sep 06 11:51:31 2017 +0000
+++ b/main.cpp	Thu Sep 07 06:03:35 2017 +0000
@@ -350,7 +350,7 @@
     
     char str[32];
 
-//    printf("SystemCoreClock =%d\n", SystemCoreClock);
+    printf("SystemCoreClock =%d\n", SystemCoreClock);
 
 //    // dump raw data
 //    uint16_t tmp = spiRxBuff[0].ltCh[6];
@@ -417,44 +417,48 @@
   */
 void SystemClock_Config(void)
 {
+    
     HAL_RCC_DeInit();
-    // not implemented yet?
-//    LL_RCC_DeInit();
-
-    /* Set FLASH latency */
-    LL_FLASH_SetLatency(LL_FLASH_LATENCY_2);
+//    LL_RCC_DeInit();    // not implemented yet?
 
-    /* Enable HSE oscillator */
-    LL_RCC_HSE_Enable();
-    while(LL_RCC_HSE_IsReady() != 1) {
-    };
-
-    /* Main PLL configuration and activation */
-    LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE_DIV_1, LL_RCC_PLL_MUL_9);
-
-    LL_RCC_PLL_Enable();
-    while(LL_RCC_PLL_IsReady() != 1) {
-    };
 
-    /* Sysclk activation on the main PLL */
-    LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
-    LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
-    while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL) {
-    };
-
-    /* Set APB1 & APB2 prescaler*/
-    LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_2);
-    LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
+//    /* Set FLASH latency */
+//    LL_FLASH_SetLatency(LL_FLASH_LATENCY_2);
+//
+//    /* Enable HSE oscillator */
+//    LL_RCC_HSE_Enable();
+//    while(LL_RCC_HSE_IsReady() != 1) {
+//    };
+//
+//    /* Main PLL configuration and activation */
+//    LL_RCC_PLL_ConfigDomain_SYS(LL_RCC_PLLSOURCE_HSE_DIV_1, LL_RCC_PLL_MUL_9);
+//
+//    LL_RCC_PLL_Enable();
+//    while(LL_RCC_PLL_IsReady() != 1) {
+//    };
+//
+//    /* Sysclk activation on the main PLL */
+//    LL_RCC_SetAHBPrescaler(LL_RCC_SYSCLK_DIV_1);
+//    LL_RCC_SetSysClkSource(LL_RCC_SYS_CLKSOURCE_PLL);
+//    while(LL_RCC_GetSysClkSource() != LL_RCC_SYS_CLKSOURCE_STATUS_PLL) {
+//    };
+//
+//    /* Set APB1 & APB2 prescaler*/
+//    LL_RCC_SetAPB1Prescaler(LL_RCC_APB1_DIV_2);
+//    LL_RCC_SetAPB2Prescaler(LL_RCC_APB2_DIV_1);
+//
+//    /* Set systick to 1ms in using frequency set to 72MHz */
+//    LL_Init1msTick(72000000);
+//
+//    /* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
+//    LL_SetSystemCoreClock(72000000);
 
-    /* Set systick to 1ms in using frequency set to 72MHz */
-    LL_Init1msTick(72000000);
 
-    /* Update CMSIS variable (which can be updated also through SystemCoreClockUpdate function) */
-    LL_SetSystemCoreClock(72000000);
-
-    // Set baud rate again.
-//    pc.baud(9600);
-    extern serial_t stdio_uart; 
+    SetSysClock_PLL_HSE(false);     // "system_clock.c", 'bypass = false' means using X'tal.
+    SystemCoreClockUpdate();        // "system_stm32f1xx.h"
+    
+    // restart uart
+    extern serial_t stdio_uart;
     serial_baud(&stdio_uart, 9600);
 }