Update repo
This commit is contained in:
1 parent
0985b9d8d7
commit
ca08965ffc
377 files changed
+178142
-220
No files matched your search
@@ -1,59 +0,0 @@
|
||||
#include "main.h"
|
||||
|
||||
void HAL_MspInit(void) {
|
||||
|
||||
__HAL_RCC_SYSCFG_CLK_ENABLE();
|
||||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
|
||||
// System interrupt init
|
||||
// PendSV_IRQn interrupt configuration
|
||||
HAL_NVIC_SetPriority(PendSV_IRQn, 15, 0);
|
||||
|
||||
}
|
||||
|
||||
void HAL_SD_MspInit(SD_HandleTypeDef *hsd) {
|
||||
GPIO_InitTypeDef GPIO_InitStruct = { 0 };
|
||||
|
||||
if (hsd->Instance == SDIO) {
|
||||
|
||||
__HAL_RCC_SDIO_CLK_ENABLE();
|
||||
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOD_CLK_ENABLE();
|
||||
|
||||
/* SDIO GPIO Configuration
|
||||
* PC8 ------> SDIO_D0
|
||||
* PC9 ------> SDIO_D1
|
||||
* PC10 ------> SDIO_D2
|
||||
* PC11 ------> SDIO_D3
|
||||
* PC12 ------> SDIO_CK
|
||||
* PD2 ------> SDIO_CMD
|
||||
*/
|
||||
|
||||
// SDIO data lines: PC8-PC11
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_8 | GPIO_PIN_9 |
|
||||
GPIO_PIN_10 | GPIO_PIN_11;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
// SDIO clock: PC12
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_12;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
|
||||
// SDIO command: PD2
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_2;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF12_SDIO;
|
||||
HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
|
||||
|
||||
/* USB MSC callbacks execute at priority 7. SDIO must preempt both USB
|
||||
* and the priority-6 HAL tick so FIFO service cannot be delayed. */
|
||||
HAL_NVIC_SetPriority(SDIO_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(SDIO_IRQn);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
/* USER CODE BEGIN Header */
|
||||
/**
|
||||
******************************************************************************
|
||||
* @file : fatfs_platform.c
|
||||
* @brief : fatfs_platform source file
|
||||
******************************************************************************
|
||||
* @attention
|
||||
*
|
||||
* Copyright (c) 2026 STMicroelectronics.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This software is licensed under terms that can be found in the LICENSE file
|
||||
* in the root directory of this software component.
|
||||
* If no LICENSE file comes with this software, it is provided AS-IS.
|
||||
*
|
||||
******************************************************************************
|
||||
*/
|
||||
/* USER CODE END Header */
|
||||
#include "fatfs_platform.h"
|
||||
|
||||
uint8_t BSP_PlatformIsDetected(void) {
|
||||
uint8_t status = SD_PRESENT;
|
||||
/* USER CODE BEGIN 1 */
|
||||
/* This board has no card-detect switch wired to the microSD socket. The
|
||||
* SD_DETECT_PIN (PD3) generated by CubeMX is only a placeholder: left as a
|
||||
* pulled-up input it always reads high, which reported SD_NOT_PRESENT on
|
||||
* every STORAGE_* call after BSP_SD_Init() and made the USB MSC host see
|
||||
* an empty drive. Report the card as always present instead. */
|
||||
/* USER CODE END 1 */
|
||||
return status;
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
#include "main.h"
|
||||
#include "usb_device.h"
|
||||
#include "usbd_desc.h"
|
||||
#include "usbd_msc.h"
|
||||
#include "usbd_storage_if.h"
|
||||
|
||||
USBD_HandleTypeDef hUsbDeviceFS;
|
||||
|
||||
void MX_USB_DEVICE_Init(void)
|
||||
{
|
||||
if (USBD_Init(&hUsbDeviceFS, &MSC_Desc, 0) != USBD_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
if (USBD_RegisterClass(&hUsbDeviceFS, &USBD_MSC) != USBD_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
if (USBD_MSC_RegisterStorage(&hUsbDeviceFS, &USBD_Storage_Interface_fops_FS) != USBD_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
|
||||
if (USBD_Start(&hUsbDeviceFS) != USBD_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>34_USB_Device_Mode_Card_Reader_VET6</name>
|
||||
<name>34_USB_Device_Mode_SD_Card_VET6</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="com.st.stm32cube.ide.mcu.debug.launch.launchConfigurationType">
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.access_port_id" value="0"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.cubeprog_external_loaders" value="[]"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.debug_auth__pwd_enable" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.debug_auth_certif_path" value=""/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.debug_auth_check_enable" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.debug_auth_key_path" value=""/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.debug_auth_permission" value=""/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.debug_auth_pwd_file" value=""/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_live_expr" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.enable_swv" value="false"/>
|
||||
<intAttribute key="com.st.stm32cube.ide.mcu.debug.launch.formatVersion" value="2"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.ip_address_local" value="localhost"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.limit_swo_clock.enabled" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.limit_swo_clock.value" value=""/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.loadList" value="{"fItems":[{"fIsFromMainTab":true,"fPath":"Debug/34_USB_Device_Mode_SD_Card_VET6.elf","fProjectName":"34_USB_Device_Mode_SD_Card_VET6","fPerformBuild":true,"fDownload":true,"fLoadSymbols":true}]}"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.override_start_address_mode" value="default"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.remoteCommand" value="target remote"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startServer" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.divby0" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.exception.unaligned" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.startuptab.haltonexception" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swd_mode" value="true"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_port" value="61235"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.swv_trace_hclk" value="168000000"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.useRemoteTarget" value="true"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.launch.vector_table" value=""/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.launch.verify_flash_download" value="true"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_allow_halt" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.cti_signal_halt" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_logging" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_max_halt_delay" value="false"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.enable_shared_stlink" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.frequency" value="0"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.halt_all_on_reset" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.log_file" value="C:\MCU_workspace\STM_workspace\STM32F4_Cortex_M4\workspace\34_USB_Device_Mode_SD_Card_VET6\Debug\st-link_gdbserver_log.txt"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.low_power_debug" value="enable"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.max_halt_delay" value="2"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.reset_strategy" value="connect_under_reset"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_check_serial_number" value="true"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.stlink_txt_serial_number" value="066AFF495580535067161527"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlink.watchdog_config" value="none"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkenable_rtos" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.debug.stlinkrestart_configurations" value="{"fVersion":1,"fItems":[{"fDisplayName":"Reset","fIsSuppressible":false,"fResetAttribute":"Software system reset","fResetStrategies":[{"fDisplayName":"Software system reset","fLaunchAttribute":"system_reset","fGdbCommands":["monitor reset\r\n"],"fCmdOptions":["-g"]},{"fDisplayName":"Hardware reset","fLaunchAttribute":"hardware_reset","fGdbCommands":["monitor reset hardware\r\n"],"fCmdOptions":["-g"]},{"fDisplayName":"Core reset","fLaunchAttribute":"core_reset","fGdbCommands":["monitor reset core\r\n"],"fCmdOptions":["-g"]},{"fDisplayName":"None","fLaunchAttribute":"no_reset","fGdbCommands":[],"fCmdOptions":["-g"]}],"fGdbCommandGroup":{"name":"Additional commands","commands":[]},"fStartApplication":true}]}"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.enableRtosProxy" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyCustomProperties" value=""/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriver" value="threadx"/>
|
||||
<booleanAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriverAuto" value="false"/>
|
||||
<stringAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyDriverPort" value="cortex_m0"/>
|
||||
<intAttribute key="com.st.stm32cube.ide.mcu.rtosproxy.rtosProxyPort" value="60000"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doHalt" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.doReset" value="false"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.initCommands" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.ipAddress" value="localhost"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.jtagDeviceId" value="com.st.stm32cube.ide.mcu.debug.stlink"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.pcRegister" value=""/>
|
||||
<intAttribute key="org.eclipse.cdt.debug.gdbjtag.core.portNumber" value="61234"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.runCommands" value=""/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setPcRegister" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setResume" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.debug.gdbjtag.core.setStopAt" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.debug.gdbjtag.core.stopAt" value="main"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="arm-none-eabi-gdb"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
|
||||
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="remote"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="Debug/34_USB_Device_Mode_SD_Card_VET6.elf"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="34_USB_Device_Mode_SD_Card_VET6"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value="com.st.stm32cube.ide.mcu.gnu.managedbuild.config.exe.debug.414006745"/>
|
||||
<booleanAttribute key="org.eclipse.debug.core.ATTR_FORCE_SYSTEM_CONSOLE_ENCODING" value="false"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/34_USB_Device_Mode_SD_Card_VET6"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.dsf.launch.MEMORY_BLOCKS" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?><memoryBlockExpressionList context="reserved-for-future-use"/>"/>
|
||||
<stringAttribute key="process_factory_id" value="com.st.stm32cube.ide.mcu.debug.launch.HardwareDebugProcessFactory"/>
|
||||
</launchConfiguration>
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+7
-92
@@ -1,13 +1,11 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "main.h"
|
||||
#include "cmsis_os.h"
|
||||
|
||||
#include "fatfs.h"
|
||||
#include "fatfs_platform.h"
|
||||
#include "usb_device.h"
|
||||
#include "usbd_storage_if.h"
|
||||
#include "bsp_driver_sd.h"
|
||||
|
||||
// System clock
|
||||
uint32_t HCLK_freq;
|
||||
@@ -27,17 +25,6 @@ int __io_putchar(int ch) {
|
||||
// LED: GPIO_PIN_13
|
||||
static void LED_GPIO_Init(void);
|
||||
|
||||
SD_HandleTypeDef hsd;
|
||||
static void SDIO_SD_Init(void);
|
||||
static void SD_Diagnostics(void);
|
||||
|
||||
/* STM32F405/407 erratum ES0182 says that SDIO hardware flow control must not
|
||||
* be used. Keep the four-bit transfer clock at a conservative 2 MHz while
|
||||
* the FIFO is serviced in interrupt mode. This is still fast enough for a
|
||||
* reliable USB-FS MSC functional test. */
|
||||
#define SDIO_TRANSFER_CLOCK_DIV 22U
|
||||
#define SDIO_TRANSFER_CLOCK_HZ (48000000U / (SDIO_TRANSFER_CLOCK_DIV + 2U))
|
||||
|
||||
int main(void) {
|
||||
uint32_t reported_storage_error = HAL_SD_ERROR_NONE;
|
||||
|
||||
@@ -46,18 +33,19 @@ int main(void) {
|
||||
USART1_UART_Init();
|
||||
LED_GPIO_Init();
|
||||
|
||||
SDIO_SD_Init();
|
||||
SD_Init();
|
||||
SD_Diagnostics();
|
||||
|
||||
MX_FATFS_Init();
|
||||
MX_USB_DEVICE_Init();
|
||||
|
||||
while (1) {
|
||||
uint32_t storage_error = STORAGE_GetLastError();
|
||||
|
||||
if ((storage_error != HAL_SD_ERROR_NONE) &&
|
||||
(storage_error != reported_storage_error)) {
|
||||
if ((storage_error != HAL_SD_ERROR_NONE)
|
||||
&& (storage_error != reported_storage_error)) {
|
||||
printf("storage I/O error: 0x%08lX\r\n",
|
||||
(unsigned long) storage_error);
|
||||
(unsigned long) storage_error);
|
||||
reported_storage_error = storage_error;
|
||||
} else if (storage_error == HAL_SD_ERROR_NONE) {
|
||||
reported_storage_error = HAL_SD_ERROR_NONE;
|
||||
@@ -66,79 +54,6 @@ int main(void) {
|
||||
|
||||
}
|
||||
|
||||
static void SDIO_SD_Init(void) {
|
||||
hsd.Instance = SDIO;
|
||||
hsd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING;
|
||||
hsd.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE;
|
||||
hsd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE;
|
||||
hsd.Init.BusWide = SDIO_BUS_WIDE_1B;
|
||||
hsd.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_DISABLE;
|
||||
hsd.Init.ClockDiv = SDIO_TRANSFER_CLOCK_DIV;
|
||||
}
|
||||
|
||||
/*
|
||||
* Bring the SD card up here, in thread mode, instead of leaving it to the first
|
||||
* STORAGE_Init() call that the USB stack makes from inside the OTG_FS ISR.
|
||||
* Everything it reports goes out on USART1 @115200, so an init failure is
|
||||
* visible instead of silently turning into a "no medium" USB drive.
|
||||
*/
|
||||
static void SD_Diagnostics(void) {
|
||||
|
||||
int8_t init_status;
|
||||
uint8_t io_status;
|
||||
HAL_SD_CardInfoTypeDef info = { 0 };
|
||||
static uint32_t sector0[128];
|
||||
uint8_t *b = (uint8_t *) sector0;
|
||||
int i;
|
||||
|
||||
printf("\r\n--- SD diagnostics ---\r\n");
|
||||
printf("detect : %u (1=present)\r\n", BSP_SD_IsDetected());
|
||||
|
||||
init_status = STORAGE_Prepare();
|
||||
printf("storage init: %d (0=ready)\r\n", init_status);
|
||||
printf("sdio clock : %lu Hz (HW flow control disabled; ES0182)\r\n",
|
||||
(unsigned long) SDIO_TRANSFER_CLOCK_HZ);
|
||||
printf("USB MSC I/O : SDIO interrupt mode\r\n");
|
||||
printf("hal state : %u errorcode: 0x%08lX\r\n",
|
||||
(unsigned) HAL_SD_GetState(&hsd), (unsigned long) HAL_SD_GetError(&hsd));
|
||||
|
||||
if (init_status != 0) {
|
||||
printf("SD init FAILED - USB drive will report no medium\r\n");
|
||||
printf("--- end ---\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
BSP_SD_GetCardInfo(&info);
|
||||
printf("card type : %lu (0=SDSC 1=SDHC/SDXC 3=secured)\r\n",
|
||||
(unsigned long) info.CardType);
|
||||
printf("card version: %lu class: 0x%lX RCA: 0x%lX\r\n",
|
||||
(unsigned long) info.CardVersion, (unsigned long) info.Class,
|
||||
(unsigned long) info.RelCardAdd);
|
||||
printf("blocks : %lu x %lu bytes\r\n",
|
||||
(unsigned long) info.BlockNbr, (unsigned long) info.BlockSize);
|
||||
printf("log blocks : %lu x %lu bytes\r\n",
|
||||
(unsigned long) info.LogBlockNbr, (unsigned long) info.LogBlockSize);
|
||||
printf("capacity : %lu MB\r\n",
|
||||
(unsigned long) ((uint64_t) info.LogBlockNbr * info.LogBlockSize / 1048576U));
|
||||
printf("card state : %u (0=SD_TRANSFER_OK)\r\n", BSP_SD_GetCardState());
|
||||
|
||||
/* Read the MBR, so a dead bus can be told apart from a dead filesystem. */
|
||||
io_status = BSP_SD_ReadBlocks(sector0, 0U, 1U, 1000U);
|
||||
printf("read LBA0 : %u (0=MSD_OK) errorcode: 0x%08lX\r\n",
|
||||
io_status, (unsigned long) HAL_SD_GetError(&hsd));
|
||||
|
||||
if (io_status == MSD_OK) {
|
||||
printf("sig 0x1FE : %02X %02X (expect 55 AA)\r\n", b[510], b[511]);
|
||||
printf("first 16 : ");
|
||||
for (i = 0; i < 16; i++) {
|
||||
printf("%02X ", b[i]);
|
||||
}
|
||||
printf("\r\n");
|
||||
}
|
||||
|
||||
printf("--- end ---\r\n");
|
||||
}
|
||||
|
||||
static void LED_GPIO_Init(void) {
|
||||
|
||||
GPIO_InitTypeDef GPIO_InitStruct = { 0 };
|
||||
@@ -214,7 +129,7 @@ void SystemClock_Config(void) {
|
||||
|
||||
// Initializes the CPU, AHB and APB buses clocks
|
||||
RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_SYSCLK
|
||||
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
|
||||
| RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2;
|
||||
RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
|
||||
RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
|
||||
RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
|
||||
@@ -0,0 +1,12 @@
|
||||
#include "main.h"
|
||||
|
||||
void HAL_MspInit(void) {
|
||||
|
||||
__HAL_RCC_SYSCFG_CLK_ENABLE();
|
||||
__HAL_RCC_PWR_CLK_ENABLE();
|
||||
|
||||
// System interrupt init
|
||||
// PendSV_IRQn interrupt configuration
|
||||
HAL_NVIC_SetPriority(PendSV_IRQn, 15, 0);
|
||||
|
||||
}
|
||||
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.
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.
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.
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.
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.
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.
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.
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.
Loaded 100 of 377 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user