### Ethernet Driver Initialization and Usage Example Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Driver/html/group__eth__interface__gr.html Example code demonstrating the typical setup and usage sequence for the Ethernet MAC and PHY drivers. ```APIDOC ## Ethernet Driver Initialization and Usage ### Description This section provides an example of how to initialize and use the Ethernet MAC and PHY drivers in combination. It shows the typical setup sequence. ### Method N/A ### Endpoint N/A ### Parameters N/A ### Request Example ```c extern ARM_DRIVER_ETH_MAC Driver_ETH_MAC0; extern ARM_DRIVER_ETH_PHY Driver_ETH_PHY0; // Example usage sequence would follow here... ``` ### Response #### Success Response (200) N/A #### Response Example N/A ``` -------------------------------- ### GET /examples/dotproduct Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/arm__dotproduct__example__f32_8c.html Retrieves the dot product example implementation for f32 data types. ```APIDOC ## GET /examples/dotproduct ### Description Provides the source code example for calculating the dot product of two vectors using f32 precision. ### Method GET ### Endpoint /examples/arm_dotproduct_example_f32.c ### Response #### Success Response (200) - **file_content** (string) - The full source code of the dot product example. #### Response Example { "file": "arm_dotproduct_example_f32.c", "status": "success" } ``` -------------------------------- ### Ethernet MAC and PHY Driver Initialization Example (C) Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Driver/html/group__eth__interface__gr.html This code snippet demonstrates the typical setup sequence for the Ethernet MAC and PHY drivers. It shows how to declare and potentially use the access structures for both drivers, which are essential for configuring and controlling the Ethernet hardware. ```c extern ARM_DRIVER_ETH_MAC Driver_ETH_MAC0; extern ARM_DRIVER_ETH_PHY Driver_ETH_PHY0; ``` -------------------------------- ### Create Simple Thread with Default Settings - C Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/RTOS2/html/group__CMSIS__RTOS__ThreadMgmt.html This example demonstrates creating a thread using default attributes and memory from the Global Memory Pool. It initializes the kernel, creates the thread, and starts the kernel. ```c #include "cmsis_os2.h" __NO_RETURN void thread1 (void *argument) { // ... for (;;) {} } int main (void) { osKernelInitialize(); ; osThreadNew(thread1, NULL, NULL); // Create thread with default settings ; osKernelStart(); } ``` -------------------------------- ### GET /arm_fir_example_f32/main Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/arm__fir__example__f32_8c.html Executes the main FIR filter example routine which processes input samples using defined coefficients and state buffers. ```APIDOC ## GET /arm_fir_example_f32/main ### Description Executes the primary FIR filter example, which processes a test input array using defined filter coefficients and compares the output against a reference signal to ensure accuracy. ### Method GET ### Endpoint /arm_fir_example_f32/main ### Parameters None ### Request Example {} ### Response #### Success Response (200) - **status** (int32_t) - Returns 0 on successful execution, non-zero otherwise. #### Response Example { "status": 0 } ``` -------------------------------- ### Basic CMSIS Example Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Core/html/using_CMSIS.html This example demonstrates how to use the CMSIS layer for basic microcontroller initialization and operation, including system tick setup, interrupt handling, and a typical application super-loop. ```APIDOC ## Basic CMSIS Example ### Description A typical example for using the CMSIS layer is provided below. The example is based on a STM32F10x Device. ### Method N/A (This is a code example, not an API endpoint) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ```c #include // File name depends on device used uint32_t volatile msTicks; void SysTick_Handler (void) { // SysTick Interrupt Handler msTicks++; // Increment Counter } void WaitForTick (void) { uint32_t curTicks; curTicks = msTicks; // Save Current SysTick Value while (msTicks == curTicks) { // Wait for next SysTick Interrupt __WFE(); // Power-Down until next Event/Interrupt } } void TIM1_UP_IRQHandler (void) { // Timer Interrupt Handler ; // Add user code here } void timer1_init(int frequency) { // Set up Timer (device specific) NVIC_SetPriority(TIM1_UP_IRQn, 1); // Set Timer priority NVIC_EnableIRQ(TIM1_UP_IRQn); // Enable Timer Interrupt } void Device_Initialization (void) { // Configure & Initialize MCU if (SysTick_Config(SystemCoreClock / 1000)) { // SysTick 1mSec // Handle Error } timer1_init(); // setup device-specific timer } // The processor clock is initialized by CMSIS startup + system file void main (void) { // user application starts here Device_Initialization(); // Configure & Initialize MCU while (1) { // Endless Loop (the Super-Loop) __disable_irq(); // Disable all interrupts Get_InputValues(); // Read Values __enable_irq(); // Enable all interrupts Calculation_Response(); // Calculate Results Output_Response(); // Output Results WaitForTick(); // Synchronize to SysTick Timer } } ``` ``` -------------------------------- ### USART Example: Asynchronous Communication Setup Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Driver/html/group__usart__interface__gr.html Example demonstrating the setup for asynchronous communication using the USART driver. It includes necessary headers and defines a thread for handling UART operations, along with a callback function for events. ```c #include "Driver_USART.h" #include "cmsis_os.h" /* ARM::CMSIS:RTOS:Keil RTX */ #include #include void myUART_Thread(void const *argument); osThreadId tid_myUART_Thread; /* USART Driver */ extern ARM_DRIVER_USART Driver_USART3; void myUSART_callback(uint32_t event) { uint32_t mask; ``` -------------------------------- ### Iterate Through Storage Blocks Example (C) Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Driver/html/group__storage__interface__gr.html An example demonstrating how to iterate through all storage blocks using ARM_Storage_GetNextBlock and ARM_STORAGE_VALID_BLOCK. This pattern allows sequential access to storage blocks, starting from the first block. ```c ARM_STORAGE_BLOCK block; for (drv->GetNextBlock(NULL, &block); ARM_STORAGE_VALID_BLOCK(&block); drv->GetNextBlock(&block, &block)) { // make use of block } ``` -------------------------------- ### ARM Signal Convergence Example Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/arm__dotproduct__example__f32_8c.html Example demonstrating the `arm_signal_converge_example_f32.c` for signal convergence analysis. ```APIDOC ## ARM Signal Convergence Example ### Description This example demonstrates the `arm_signal_converge_example_f32.c`, likely related to analyzing signal convergence properties using CMSIS-DSP functions. ### Method N/A (This is a code example, not an API endpoint) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Example Device Configuration Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Pack/html/sdf_pg.html An example of how a device element with its configuration items might be represented. ```APIDOC ## Example Device Configuration ### Description This example demonstrates the structure of a `device` element with its associated `device_info_items` and `config_items`. ### Device Element ```xml 3.5 true 0xE0041000 0 ``` ``` -------------------------------- ### ARM Signal Convergence Example (f32) Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/files.html An example demonstrating signal convergence for floating-point data. ```c #include "arm_math.h" // Example usage of arm_signal_converge_data void arm_signal_converge_example_f32(void); ``` -------------------------------- ### ARM Math Helper Header for Signal Convergence Example Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/files.html Header file for helper functions used in the signal convergence example. ```c #ifndef _MATH_HELPER_H #define _MATH_HELPER_H #include "arm_math.h" // Function prototypes and definitions for signal convergence example helpers #endif /* _MATH_HELPER_H */ ``` -------------------------------- ### Add Example Project to PDSC File Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Pack/html/cp_SWComponents.html This snippet illustrates how to define an example project within the PDSC file. It includes an section with an element specifying the project name, documentation, board, environment, and required components. ```xml CMSIS-RTOS based example Example project added ``` -------------------------------- ### CMSIS-RTOS Thread and Kernel Management in C Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/RTOS/html/usingOS.html This C code example demonstrates how to initialize the CMSIS-RTOS kernel, define and create multiple threads with different priorities, and start the RTOS execution. It includes thread functions with delays and thread creation calls. ```c #include "cmsis_os.h" // CMSIS-RTOS header file void job1 (void const *argument) { // thread function 'job1' while (1) { : // execute some code osDelay (10); // delay execution for 10 milliseconds } } osThreadDef(job1, osPriorityAboveNormal, 1, 0); // define job1 as thread function void job2 (void const *argument) { // thread function 'job2' osThreadCreate (osThread(job1),NULL); // create job1 thread while (1) { : // execute some code } } osThreadDef(job2, osPriorityNormal, 1, 0); // define job2 as thread function void job3 (void const *argument) { // thread function 'job3' while (1) { : // execute some code osDelay (20); // delay execution for 20 milliseconds } } osThreadDef(job3, osPriorityNormal, 1, 0); // define job3 as thread function int main (void) { // program execution starts here osKernelInitialize (); // initialize RTOS kernel : // setup and initialize peripherals osThreadCreate (osThread(job2)); osThreadCreate (osThread(job3)); osKernelStart (); // start kernel with job2 execution } ``` -------------------------------- ### ARM Math Helper Header for Matrix Example Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/files.html Header file for helper functions used in the matrix operations example. ```c #ifndef _MATH_HELPER_H #define _MATH_HELPER_H #include "arm_math.h" // Function prototypes and definitions for matrix example helpers #endif /* _MATH_HELPER_H */ ``` -------------------------------- ### ARM Math Helper Header for FIR Example Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/files.html Header file for helper functions used in the FIR filter example. ```c #ifndef _MATH_HELPER_H #define _MATH_HELPER_H #include "arm_math.h" // Function prototypes and definitions for FIR example helpers #endif /* _MATH_HELPER_H */ ``` -------------------------------- ### ARM Math Helper Header for Convolution Example Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/files.html Header file for helper functions used in the convolution example. ```c #ifndef _MATH_HELPER_H #define _MATH_HELPER_H #include "arm_math.h" // Function prototypes and definitions for convolution example helpers #endif /* _MATH_HELPER_H */ ``` -------------------------------- ### Start CMSIS-RTOS Timer Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/RTOS/html/group__CMSIS__RTOS__TimerMgmt.html Demonstrates defining a timer and starting it with a specified delay using osTimerStart. ```C #include "cmsis_os.h" void Time_Callback (void const *arg) { } osTimerDef(Timer, Time_Callback); uint32_t exec; void TimerStart_example (void) { osTimerId id; osStatus status; exec = 1; id = osTimerCreate(osTimer(Timer2), osTimerPeriodic, NULL); status = osTimerStart(id, 1000UL); } ``` -------------------------------- ### ARM Graphic Equalizer Example Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/arm__dotproduct__example__f32_8c.html Example demonstrating the `arm_graphic_equalizer_example_q31.c` for graphic equalizer implementation. ```APIDOC ## ARM Graphic Equalizer Example ### Description This example demonstrates the `arm_graphic_equalizer_example_q31.c`, showcasing the implementation of a graphic equalizer using 31-bit fixed-point CMSIS-DSP functions. ### Method N/A (This is a code example, not an API endpoint) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### ARM Math Helper Header for Graphic Equalizer Example Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/files.html Header file for helper functions used in the graphic equalizer example. ```c #ifndef _MATH_HELPER_H #define _MATH_HELPER_H #include "arm_math.h" // Function prototypes and definitions for graphic equalizer example helpers #endif /* _MATH_HELPER_H */ ``` -------------------------------- ### ARM Math Helper Header for Linear Interpolation Example Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/files.html Header file for helper functions used in the linear interpolation example. ```c #ifndef _MATH_HELPER_H #define _MATH_HELPER_H #include "arm_math.h" // Function prototypes and definitions for linear interpolation example helpers #endif /* _MATH_HELPER_H */ ``` -------------------------------- ### ARM Matrix Operation Examples Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/arm__dotproduct__example__f32_8c.html Examples demonstrating various ARM CMSIS-DSP matrix operation functions. ```APIDOC ## ARM Matrix Operation Examples ### Description This section covers examples for ARM CMSIS-DSP matrix operations, including: - `arm_matrix_example_f32.c` - Matrix addition: `arm_mat_add_f32`, `arm_mat_add_q15`, `arm_mat_add_q31`. - Complex matrix multiplication: `arm_mat_cmplx_mult_f32`, `arm_mat_cmplx_mult_q15`, `arm_mat_cmplx_mult_q31`. - Matrix inversion: `arm_mat_inverse_f32`, `arm_mat_inverse_f64`. - Matrix multiplication: `arm_mat_mult_f32`, `arm_mat_mult_fast_q15`. These examples illustrate how to perform common matrix computations using the CMSIS-DSP library. ### Method N/A (These are code examples, not API endpoints) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### ARM FFT Examples Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/arm__dotproduct__example__f32_8c.html Examples demonstrating the usage of ARM CMSIS-DSP Fast Fourier Transform (FFT) functions. ```APIDOC ## ARM FFT Examples ### Description This section covers examples for ARM CMSIS-DSP Fast Fourier Transform (FFT) functions, including: - `arm_fft_bin_example_f32.c` - Initialization functions like `arm_cfft_radix2_init_f32`, `arm_cfft_radix2_init_q15`, `arm_cfft_radix2_init_q31`, `arm_cfft_radix4_init_f32`, `arm_cfft_radix4_init_q15`, `arm_cfft_radix4_init_q31`. These examples illustrate how to configure and utilize FFT algorithms for various data types. ### Method N/A (These are code examples, not API endpoints) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ``` -------------------------------- ### Full RTOS Configuration Wizard Example Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Pack/html/configWizard.html A comprehensive example demonstrating various Configuration Wizard features including headers, numeric ranges, boolean toggles, and drop-down selections for RTOS kernel parameters. ```C // Thread Configuration // Number of concurrent running threads <0-250> #ifndef OS_TASKCNT #define OS_TASKCNT 6 #endif // Check for stack overflow #ifndef OS_STKCHECK #define OS_STKCHECK 1 #endif // Processor mode for thread execution // <0=> Unprivileged mode // <1=> Privileged mode #ifndef OS_RUNPRIV #define OS_RUNPRIV 1 #endif // ``` -------------------------------- ### FmBlock Get Start Address Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Zone/genmodel/com/arm/cmsis/zone/gen/data/FmBlock.html Returns the starting memory address of this block. This is a long integer representing the base address. ```Java long getStart() ``` -------------------------------- ### Flash Driver Initialization and Usage Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Driver/html/group__flash__interface__gr.html Demonstrates the typical setup sequence for the Flash driver, including initializing the device, setting up a callback for event handling, reading data, and power management using CMSIS-RTOS2. ```c #include "Driver_Flash.h" #include "cmsis_os2.h" extern ARM_DRIVER_FLASH Driver_Flash0; static ARM_DRIVER_FLASH * flashDev = &Driver_Flash0; osThreadId_t Flash_Thread_Id; void Flash_Callback(uint32_t event) { if (event & ARM_FLASH_EVENT_READY) { osThreadFlagsSet(Flash_Thread_Id, 1U); } if (event & ARM_FLASH_EVENT_ERROR) { __breakpoint(0); } } void Flash_Thread (void *argument) { const ARM_FLASH_CAPABILITIES capabilities = flashDev->GetCapabilities(); if (capabilities.event_ready) { flashDev->Initialize (&Flash_Callback); } else { flashDev->Initialize (NULL); } flashDev->PowerControl (ARM_POWER_FULL); uint8_t buf[256U]; flashDev->ReadData (0x1000U, buf, sizeof(buf)>>capabilities.data_width); if (capabilities.event_ready) { osThreadFlagsWait (1U, osFlagsWaitAny, 100U); } else { osDelay(100U); } flashDev->PowerControl (ARM_POWER_OFF); flashDev->Uninitialize (); } ``` -------------------------------- ### Start a Periodic Timer with CMSIS-RTOS Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/RTOS2/html/group__CMSIS__RTOS__TimerMgmt.html Demonstrates how to create and start a periodic timer using osTimerNew and osTimerStart. The example includes a callback function and error checking for the start operation. ```c #include "cmsis_os2.h" void Timer_Callback (void *arg) { // timer callback function } uint32_t exec; void TimerStart_example (void) { osTimerId_t id; uint32_t timerDelay; osStatus_t status; exec = 1; id = osTimerNew(Timer_Callback, osTimerPeriodic, &exec, NULL); if (id) { timerDelay = 1000; status = osTimerStart(id, timerDelay); if (status != osOK) { // Timer could not be started } } } ``` -------------------------------- ### Get RTOS Kernel Tick Count (C) Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/RTOS2/html/group__CMSIS__RTOS__KernelCtrl.html Retrieves the current RTOS kernel tick count. This function can be called from Interrupt Service Routines. It returns the number of system ticks elapsed since the RTOS kernel started. An example demonstrates its use for periodic delays and handling potential overflows with a 64-bit counter. ```C #include "cmsis_os2.h" void Thread_1 (void *arg) { uint32_t tick; tick = osKernelGetTickCount(); for (;;) { tick += 1000; osDelayUntil(tick); } } ``` ```C uint64_t GetTick(void) { static uint32_t tick_h = 0U; static uint32_t tick_l = 0U; uint32_t tick; tick = osKernelGetTickCount(); if (tick < tick_l) { tick_h++; } tick_l = tick; return (((uint64_t)tick_h << 32) | tick_l); } ``` -------------------------------- ### Initialize and Configure CAN Driver Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Driver/html/group__can__interface__gr.html This example demonstrates how to initialize the CAN driver, set the power state, configure the operating mode, and set the nominal bitrate. It includes error handling and the use of signal callbacks for asynchronous event management. ```c #include #include #include "cmsis_os.h" #include "Driver_CAN.h" #define CAN_CONTROLLER 1 #define _CAN_Driver_(n) Driver_CAN##n #define CAN_Driver_(n) _CAN_Driver_(n) extern ARM_DRIVER_CAN CAN_Driver_(CAN_CONTROLLER); #define ptrCAN (&CAN_Driver_(CAN_CONTROLLER)) void CAN_SignalUnitEvent (uint32_t event) {} void CAN_SignalObjectEvent (uint32_t obj_idx, uint32_t event) { if (event == ARM_CAN_EVENT_RECEIVE) { ptrCAN->MessageRead(obj_idx, &rx_msg_info, rx_data, 8U); } } int main (void) { ARM_CAN_CAPABILITIES can_cap; int32_t status; can_cap = ptrCAN->GetCapabilities (); status = ptrCAN->Initialize (CAN_SignalUnitEvent, CAN_SignalObjectEvent); if (status != ARM_DRIVER_OK) { Error_Handler(); } status = ptrCAN->PowerControl (ARM_POWER_FULL); status = ptrCAN->SetMode (ARM_CAN_MODE_INITIALIZATION); status = ptrCAN->SetBitrate (ARM_CAN_BITRATE_NOMINAL, 100000U, ARM_CAN_BIT_PROP_SEG(5U) | ARM_CAN_BIT_PHASE_SEG1(1U)); return 0; } ``` -------------------------------- ### osKernelStart Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/RTOS/html/group__CMSIS__RTOS__KernelCtrl.html Starts the RTOS kernel and begins thread switching. ```APIDOC ## osKernelStart ### Description Starts the RTOS kernel and begins the execution of created threads. This function typically does not return. ### Method Function Call ### Parameters None ### Response - **void** - Does not return a value upon successful kernel start. ``` -------------------------------- ### Get Block Start Address (Java) Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Zone/genmodel/com/arm/cmsis/zone/gen/data/FmBlock.html Retrieves the starting memory address of the FmBlock. This method is part of the FmBlock class and returns a long integer representing the address. ```Java public long getStart() { // Implementation to get start address return 0L; } ``` -------------------------------- ### Main Function Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/NN/html/arm__nnexamples__gru_8cpp.html The `main` function serves as the entry point for the GRU example. It is responsible for initializing and running the GRU example, likely setting up necessary buffers and calling the `gru_example` function. ```APIDOC ## int main ### Description Entry point for the GRU example application. ### Method N/A (C function) ### Endpoint N/A (C function) ### Parameters None ### Request Example N/A ### Response #### Success Response (0) Returns 0 upon successful execution. #### Response Example ```json { "return_code": 0 } ``` ``` -------------------------------- ### Initialize and Start RTX5 Kernel Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/RTOS2/html/cre_rtx_proj.html Demonstrates the standard sequence for initializing the RTX5 kernel, setting NVIC priority grouping, creating threads, and starting the kernel execution. ```C osKernelInitialize(); NVIC_SetPriorityGrouping(3); tread_id = osThreadNew(tread_func, NULL, NULL); osKernelStart(); ``` -------------------------------- ### MCI Setup Transfer (Read Sector) Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Driver/html/group__mci__interface__gr.html Example of setting up a data transfer for reading a sector from the memory card. ```APIDOC ## MCI Setup Transfer (Read Sector) ### Description This function sets up a data transfer to read a 512-byte sector from the memory card into a provided buffer. It configures the transfer type as a block read. ### Method `void read_sector([ARM_DRIVER_MCI](group__mci__interface__gr.html#structARM__DRIVER__MCI) *drv, uint8_t *buf, uint32_t sz)` ### Parameters - **drv** (*[ARM_DRIVER_MCI]*): Pointer to the MCI driver structure. - **buf** (*uint8_t*): Pointer to the buffer where the sector data will be stored. - **sz** (*uint32_t*): The size of the buffer. Must be at least 512 bytes for a sector read. ### Request Example ```c volatile uint32_t MCI_Events; void MCI_SignalEvent_Callback (uint32_t event) { MCI_Events |= event; // Save current event } void read_sector(ARM_DRIVER_MCI *drv, uint8_t *buf, uint32_t sz) { int32_t status; uint32_t cmd, arg; uint32_t resp; if (sz < 512U) { // Invalid buffer size, sector consists of 512 bytes // ... return; } status = drv->SetupTransfer(buf, 1U, 512U, ARM_MCI_TRANSFER_READ | ARM_MCI_TRANSFER_BLOCK); if (status == ARM_DRIVER_OK) { MCI_Events = 0U; // Clear MCI driver event flags cmd = 17U; // Set READ_SINGLE_BLOCK command arg = 0U; // Set sector number (example: sector 0) // Further steps would involve sending the command and waiting for transfer completion event } else { // Error setting up transfer } } ``` ### Response #### Success Response (0) Indicates that the data transfer setup was successful. #### Error Response Indicates an error during the transfer setup process. ``` -------------------------------- ### GET /cmsis-core/cortex-a/variables/e Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Core_A/html/functions_vars_e.html Retrieves the list of variable definitions starting with the letter 'e' within the CMSIS-Core (Cortex-A) framework. ```APIDOC ## GET /cmsis-core/cortex-a/variables/e ### Description Returns a list of data fields and variables starting with 'e' used in Cortex-A processor-based devices, such as control register flags and configuration types. ### Method GET ### Endpoint /cmsis-core/cortex-a/variables/e ### Parameters None ### Request Example GET /cmsis-core/cortex-a/variables/e ### Response #### Success Response (200) - **E** (CPSR_Type) - Variable field in CPSR_Type - **e_t** (mmu_region_attributes_Type) - Variable field in mmu_region_attributes_Type - **EE** (SCTLR_Type) - Variable field in SCTLR_Type - **ENABLE** (CNTP_CTL_Type) - Variable field in CNTP_CTL_Type - **EOIR** (GICInterface_Type) - Variable field in GICInterface_Type - **EVENT_CONTROL** (L2C_310_TypeDef) - Variable field in L2C_310_TypeDef - **EXCL** (ACTLR_Type) - Variable field in ACTLR_Type - **ExT** (DFSR_Type/IFSR_Type) - Variable field in DFSR_Type and IFSR_Type #### Response Example { "variables": [ {"name": "E", "type": "CPSR_Type"}, {"name": "EE", "type": "SCTLR_Type"}, {"name": "ENABLE", "type": "CNTP_CTL_Type"}, {"name": "EOIR", "type": "GICInterface_Type"} ] } ``` -------------------------------- ### Initialize RTX5 Kernel and Main Thread Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/RTOS2/html/os2MigrationGuide.html Demonstrates how to rename the standard main function to app_main and create a new main entry point that initializes the system clock, the RTOS kernel, and starts the scheduler. ```C #include "RTE_Components.h" #include CMSIS_device_header void app_main (void const *argument) { // contents of old "main" } osThreadDef(app_main, osPriorityNormal, 1, 0); int main (void) { SystemCoreClockUpdate(); osKernelInitialize(); osThreadCreate(osThread(app_main), NULL); osKernelStart(); for (;;); } ``` -------------------------------- ### ARM Linear Interpolation Example (F32) Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/arm__linear__interp__example__f32_8c.html This example demonstrates the usage of the ARM linear interpolation function for 32-bit floating-point numbers. It includes setup for input signals, reference sine wave outputs, and output buffers for interpolation results. The example utilizes predefined constants for test length and spacing. ```c /*------------------------------------------------------------------------------------------------*/ /** * @brief Linear interpolation example * @param[in] x pointer to input buffer * @param[out] y pointer to output buffer * @param[in] n number of samples * @return function returns @ref ARM_MATH_SUCCESS if the example is successfully completed, and @ref ARM_MATH_TEST_FAILURE otherwise. */ /*------------------------------------------------------------------------------------------------*/ int32_t arm_linear_interp_example_f32(float32_t *x, float32_t *y, uint32_t n) { /* Local variables */ static float32_t input_signal[TEST_LENGTH_SAMPLES]; static float32_t output_signal[TEST_LENGTH_SAMPLES]; static float32_t ref_sin_output[TEST_LENGTH_SAMPLES]; float32_t snr1, snr2; int32_t i; uint32_t test_length; /*------------------------------------------------------------------------------------------------*/ /* Initialize the static arrays */ test_length = TEST_LENGTH_SAMPLES; /* Generate the input signal */ arm_sin_f32(input_signal, test_length, 0.0F, 1.0F, 0.0F); /* Generate the reference sine output */ arm_sin_f32(ref_sin_output, test_length, 0.0F, 1.0F, 0.0F); /* Call the linear interpolation function */ arm_linear_interp_f32(input_signal, ref_sin_output, output_signal, test_length); /* Calculate SNR for the output */ snr1 = arm_snr_f32(ref_sin_output, output_signal, test_length); /* Calculate SNR for the input */ snr2 = arm_snr_f32(ref_sin_output, input_signal, test_length); /* Check the output of the linear interpolation function */ if (arm_неточный_сравнение_f32(output_signal, ref_sin_output, test_length) > 1e-5) { return (ARM_MATH_TEST_FAILURE); } /* Check the SNR values */ if (snr1 < 15.0F) { return (ARM_MATH_TEST_FAILURE); } /* Check the SNR values */ if (snr2 < 15.0F) { return (ARM_MATH_TEST_FAILURE); } /* Return the status of the test */ return (ARM_MATH_SUCCESS); } ``` -------------------------------- ### Create and Start a Periodic Timer in C Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/RTOS/html/group__CMSIS__RTOS__TimerMgmt.html Demonstrates how to create a periodic timer using osTimerCreate and start it with a specified delay using osTimerStart. It includes the necessary setup for a timer callback function. This function is part of the CMSIS-RTOS API. ```c #include "cmsis_os.h" void Timer_Callback (void const *arg); // prototype for timer callback function osTimerDef(Timer, Timer_Callback); // define timer void TimerStart_example (void) { osTimerId id; // timer id osStatus status; // function return status int exec; uint32_t timerDelay; // Create periodic timer exec = 1; id = osTimerCreate(osTimer(Timer), osTimerPeriodic, NULL); if (id) { timerDelay = 1000; status = osTimerStart (id, timerDelay); // start timer if (status != osOK) { // Timer could not be started } } } ``` -------------------------------- ### Globals - W Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/globals_w.html This section details global elements starting with the letter 'W', including weights for DCT-IV and example wires. ```APIDOC ## Globals - W ### Description This section lists global variables, defines, and typedefs that start with the letter 'W'. These include various weight tables for DCT-IV implementations (float, Q15, Q31) and wire variables used in signal processing examples. ### Method N/A (This is a documentation listing, not an API endpoint) ### Endpoint N/A ### Parameters N/A ### Request Example N/A ### Response N/A ### Details: * **Weights_128** (Variable) - Weights for DCT-IV (f32) - Defined in `arm_dct4_init_f32.c`. * **Weights_2048** (Variable) - Weights for DCT-IV (f32) - Defined in `arm_dct4_init_f32.c`. * **Weights_512** (Variable) - Weights for DCT-IV (f32) - Defined in `arm_dct4_init_f32.c`. * **Weights_8192** (Variable) - Weights for DCT-IV (f32) - Defined in `arm_dct4_init_f32.c`. * **WeightsQ15_128** (Variable) - Weights for DCT-IV (q15) - Defined in `arm_dct4_init_q15.c`. * **WeightsQ15_2048** (Variable) - Weights for DCT-IV (q15) - Defined in `arm_dct4_init_q15.c`. * **WeightsQ15_512** (Variable) - Weights for DCT-IV (q15) - Defined in `arm_dct4_init_q15.c`. * **WeightsQ15_8192** (Variable) - Weights for DCT-IV (q15) - Defined in `arm_dct4_init_q15.c`. * **WeightsQ31_128** (Variable) - Weights for DCT-IV (q31) - Defined in `arm_dct4_init_q31.c`. * **WeightsQ31_2048** (Variable) - Weights for DCT-IV (q31) - Defined in `arm_dct4_init_q31.c`. * **WeightsQ31_512** (Variable) - Weights for DCT-IV (q31) - Defined in `arm_dct4_init_q31.c`. * **WeightsQ31_8192** (Variable) - Weights for DCT-IV (q31) - Defined in `arm_dct4_init_q31.c`. * **wire1** (Variable) - Used in `arm_variance_example_f32.c` and `arm_signal_converge_example_f32.c`. * **wire2** (Variable) - Used in `arm_signal_converge_example_f32.c` and `arm_variance_example_f32.c`. * **wire3** (Variable) - Used in `arm_signal_converge_example_f32.c` and `arm_variance_example_f32.c`. ``` -------------------------------- ### Debug Port Management Sequences Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Pack/html/debug_description.html Endpoints for managing the connection lifecycle of the debug port, including setup, start, and stop operations. ```APIDOC ## POST /debug/port/setup ### Description Prepares the target debug port for connection. This must be executed before acquiring access to the debug port. ### Method POST ### Endpoint /debug/port/setup ### Parameters None ### Request Example {} ### Response #### Success Response (200) - **status** (string) - Success message indicating port is ready. #### Response Example { "status": "success" } ``` -------------------------------- ### Dot Product Example Configuration and Execution Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/arm__dotproduct__example__f32_8c.html This snippet illustrates the core components of the dot product example, including buffer definitions and the main function structure. It utilizes CMSIS-DSP functions like arm_mult_f32 and arm_add_f32 to compute results and verify them against a reference value. ```c #define MAX_BLOCKSIZE 32 #define DELTA 0.0001f float32_t srcA_buf_f32[MAX_BLOCKSIZE]; float32_t srcB_buf_f32[MAX_BLOCKSIZE]; float32_t multOutput[MAX_BLOCKSIZE]; float32_t testOutput; float32_t refDotProdOut; int32_t main(void) { arm_status status; // Implementation involves arm_mult_f32 and arm_add_f32 // Verification against refDotProdOut using DELTA threshold return 0; } ``` -------------------------------- ### GET /data-fields/g Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Core_A/html/functions_g.html Retrieves the definitions and structural mappings for data fields starting with the letter 'g' within the CMSIS-Core (Cortex-A) library. ```APIDOC ## GET /data-fields/g ### Description Returns the list of struct and union fields starting with 'g' used in the CMSIS-Core (Cortex-A) implementation. ### Method GET ### Endpoint /data-fields/g ### Parameters #### Query Parameters - **index** (string) - Optional - Filter by specific index character (e.g., 'g') ### Request Example GET /data-fields/g ### Response #### Success Response (200) - **fields** (array) - List of field objects containing name and parent structure #### Response Example { "fields": [ { "name": "g_t", "parent": "mmu_region_attributes_Type" }, { "name": "GE", "parent": "CPSR_Type" } ] } ``` -------------------------------- ### Thread Termination Example Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/RTOS2/html/group__CMSIS__RTOS__ThreadMgmt.html Shows the setup for terminating a thread using osThreadTerminate. It includes the necessary header inclusion and function prototype declaration. ```c #include "cmsis_os2.h" void Thread_1 (void *arg); // function prototype for Thread_1 void ThreadTerminate_example (void) { osStatus_t status; osThreadId_t id; } ``` -------------------------------- ### SystemInit Function Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Core/html/group__system__init__gr.html Initializes the microcontroller system, including oscillator configuration and updating the SystemCoreClock variable. ```APIDOC ## SystemInit Function ### Description Initializes the microcontroller system. Typically, this function configures the oscillator (PLL) that is part of the microcontroller device. For systems with a variable clock speed, it updates the variable [SystemCoreClock]. SystemInit is called from the file **startup_device.c**. ### Method (Implicitly called during startup) ### Endpoint N/A ### Parameters None ### Request Example N/A ### Response N/A ``` -------------------------------- ### C FIR Filter Implementation Example Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/arm_fir_example_f32_8c-example.html This C code demonstrates the setup and execution of a floating-point FIR filter using the CMSIS-DSP library. It includes definitions for filter parameters, input/output buffers, and external data sources. The example is targeted for Cortex-M4/M3 processors. ```c /* ---------------------------------------------------------------------- * Copyright (C) 2010-2012 ARM Limited. All rights reserved. * * $Date: 17. January 2013 * $Revision: V1.4.0 * * Project: CMSIS DSP Library * Title: arm_fir_example_f32.c * * Description: Example code demonstrating how an FIR filter can be used * as a low pass filter. * * Target Processor: Cortex-M4/Cortex-M3 * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * - Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * - Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * - Neither the name of ARM LIMITED nor the names of its contributors * may be used to endorse or promote products derived from this * software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * -------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- ** Include Files ** ------------------------------------------------------------------- */ #include "arm_math.h" #include "math_helper.h" /* ---------------------------------------------------------------------- ** Macro Defines ** ------------------------------------------------------------------- */ #define TEST_LENGTH_SAMPLES 320 #define SNR_THRESHOLD_F32 140.0f #define BLOCK_SIZE 32 #define NUM_TAPS 29 /* -------------------------------------------------------------------* * The input signal and reference output (computed with MATLAB) * are defined externally in arm_fir_lpf_data.c. * ------------------------------------------------------------------- */ extern float32_t testInput_f32_1kHz_15kHz[TEST_LENGTH_SAMPLES]; extern float32_t refOutput[TEST_LENGTH_SAMPLES]; /* -------------------------------------------------------------------* * Declare Test output buffer * ------------------------------------------------------------------- */ static float32_t testOutput[TEST_LENGTH_SAMPLES]; /* -------------------------------------------------------------------* * Declare State buffer of size (numTaps + blockSize - 1) */ ``` -------------------------------- ### System Initialization (C) Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Projects/STM32F072B-Discovery/Examples/RTC/RTC_Alarm/readme.txt This code demonstrates the initial setup of the microcontroller system. It calls HAL_Init() to reset peripherals and initialize the Flash interface and SysTick timer, followed by SystemClock_Config() to set the system clock frequency to 48 MHz. ```c /* Reset of all peripherals, Initializes the Flash interface and the Systick. */ hal_init(); /* Configure the system clock */ SystemClock_Config(); ``` -------------------------------- ### Storage Interface Initialization and Shutdown Sequences Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Driver/html/group__storage__interface__gr.html Demonstrates the correct sequence of function calls to initialize and power up a storage peripheral, as well as the corresponding sequence to power down and release resources. ```C /* Start Sequence */ drv->Initialize(...); // Allocate I/O pins drv->PowerControl(ARM_POWER_FULL); // Power up peripheral, setup IRQ/DMA /* Stop Sequence */ drv->PowerControl(ARM_POWER_OFF); // Terminate transfers, reset IRQ/DMA, power off drv->Uninitialize(...); // Release I/O pins ``` -------------------------------- ### Debug Access Variables Configuration Example (.dbgconf) Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Pack/html/pdsc_family_pg.html An example of a debug configuration file (.dbgconf) used to assign default values to global debug access variables. This file is editable by the end-user and can include user interface annotations for easier configuration of options like trace pin setup. ```c // File: EFM32WGxxx.dbgconf // Version: 1.0 // <<< Use Configuration Wizard in Context Menu >>> // Trace Pin Setup // TPIU Pin Location // <0=> Pin Location 0 // <1=> Pin Location 1 // <2=> Pin Location 2 // <3=> Pin Location 3 // Select TPIU pin location for your board configuration: // - Pin Location 0 (TRACECLK: PD7, TRACEDATA0: PD6, TRACEDATA1: PD3, TRACEDATA2: PD4, TRACEDATA3: PD5) // - Pin Location 1 (TRACECLK: PF8, TRACEDATA0: PF9, TRACEDATA1: PD13, TRACEDATA2: PB15, TRACEDATA3: PF3) // - Pin Location 2 (TRACECLK: PC6, TRACEDATA0: PC7, TRACEDATA1: PD3, TRACEDATA2: PD4, TRACEDATA3: PD5) // - Pin Location 3 (TRACECLK: PA6, TRACEDATA0: PA2, TRACEDATA1: PA3, TRACEDATA2: PA4, TRACEDATA3: PA5) // Default: Pin Location 0 __TPIU_pinlocation = 0; // SWO Pin Location // <0=> Pin Location 0 // <1=> Pin Location 1 // <2=> Pin Location 2 // <3=> Pin Location 3 // Select SWO pin location for your board configuration: // - Pin Location 0 (SWO: PF2) // - Pin Location 1 (SWO: PC15) // - Pin Location 2 (SWO: PD1) // - Pin Location 3 (SWO: PD2) // Default: Pin Location 0 __SWO_pinlocation = 0; // // <<< end of configuration section >>> ``` -------------------------------- ### Initialize and Power Up Peripheral Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Driver/html/theoryOperation.html Demonstrates the standard sequence for initializing a peripheral and setting it to full power mode using the CMSIS-Driver API. ```C drv->Initialize(NULL); // Allocate I/O pins drv->PowerControl(ARM_POWER_FULL); // Power up peripheral, setup IRQ/DMA ``` -------------------------------- ### Calculate Max Energy Bin FFT Example (C) Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/DSP/html/arm_fft_bin_example_f32_8c-example.html This C code demonstrates how to calculate the maximum energy bin of the frequency domain of an input signal using the CMSIS-DSP library's FFT functions. It includes setup for FFT size, bit reversal, and processing of input and output buffers. The example is targeted for Cortex-M4/M3 processors. ```c #include "arm_math.h" #include "arm_const_structs.h" #define TEST_LENGTH_SAMPLES 2048 extern float32_t testInput_f32_10khz[TEST_LENGTH_SAMPLES]; static float32_t testOutput[TEST_LENGTH_SAMPLES/2]; uint32_t fftSize = 1024; uint32_t ifftFlag = 0; uint32_t doBitReverse = 1; /* Reference index at which max energy of bin ocuurs */ uint32_t refIndex = 213, testIndex = 0; /* Max magnitude FFT Bin test */ ``` -------------------------------- ### Initialize and Use I2C Master Mode Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Driver/html/group__i2c__interface__gr.html This example demonstrates how to set up an I2C driver instance and define a callback function for handling I2C events such as transfer completion or errors. ```c #include "Driver_I2C.h" #define EEPROM_I2C_ADDR 0x51 extern ARM_DRIVER_I2C Driver_I2C0; static ARM_DRIVER_I2C *I2Cdrv = &Driver_I2C0; static volatile uint32_t I2C_Event; void I2C_SignalEvent (uint32_t event) { I2C_Event |= event; if (event & ARM_I2C_EVENT_TRANSFER_INCOMPLETE) { /* Handle incomplete transfer */ } } ``` -------------------------------- ### Initialize and Start CMSIS-RTOS Kernel Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/RTOS/html/group__CMSIS__RTOS__KernelCtrl.html Demonstrates the standard procedure for initializing the CMSIS-RTOS kernel and starting thread execution within the main function. ```c int main (void) { osKernelInitialize(); // initialize CMSIS-RTOS // initialize peripherals here // create 'thread' functions that start executing osKernelStart(); // start thread execution } ``` -------------------------------- ### Define Generator Project Files Source: https://github.com/stmicroelectronics/stm32cubef0/blob/master/Drivers/CMSIS/docs/Pack/html/pdsc_generators_pg.html Example of defining source and header files required for a project setup within a generator element. This configuration uses the project_files group to list files that the generator will manage. ```xml ```