色哟哟视频在线观看-色哟哟视频在线-色哟哟欧美15最新在线-色哟哟免费在线观看-国产l精品国产亚洲区在线观看-国产l精品国产亚洲区久久

電子發燒友App

硬聲App

0
  • 聊天消息
  • 系統消息
  • 評論與回復
登錄后你可以
  • 下載海量資料
  • 學習在線課程
  • 觀看技術視頻
  • 寫文章/發帖/加入社區
會員中心
創作中心

完善資料讓更多小伙伴認識你,還能領取20積分哦,立即完善>

3天內不再提示
創作
電子發燒友網>電子資料下載>類型>參考設計>STM32處理器上的示例

STM32處理器上的示例

2021-03-23 | pdf | 356.38KB | 次下載 | 3積分

資料介紹

This version (24 Jan 2020 10:48) was approved by Michael Bradley.The Previously approved version (26 Jul 2019 18:51) is available.Diff

AD7124 Example on STM32 Processors

Introduction

This describes how to take the AD7124 example code and integrate it with STM32 firmware libraries in a suitable development environment to produce a complete program. The IDE used here is the STM32CubeIDE, but the general procedure can be applied to other IDEs.

Overview

The AD7124 is a low power, low noise, completely integrated analog front end for high precision measurement applications. The device contains a low noise, 24-bit Σ-Δ analog-to-digital converter (ADC). The AD7124 example application provides a terminal based console interface that allows a user to select between different configurations, and to sample data in single or continuous conversion modes.

The example makes use of the AD7124 No-OS software drivers and platform drivers that are using the STM32 HAL firmware libraries.

The example code was developed and tested using the Nucleo-L476RG with version 1.14.0 of the STM32 firmware libraries, and STMCube32IDE v1.0.0. However, it may be re-targeted to other STM32 processors/boards, through the use of the appropriate ST firmware HAL libraries.

Software Integration Guide

Downloads

Project Creation

  • If you have not already done so, install the STM32CubeIDE available from www.st.com.
  • In the Firmware Update section of the STM32CubeIDE preferences, set the location to where the firmware package is going to be stored.
    • You may want to place this in a common location, e.g. 'C:/ST/Repository' and not in a directory located under your home directory, to avoid user specific paths in any shared configuration files

  • Select the File ? New ? STM32 project menu option.
  • Select the MCU part number or Board being used

  • Give the Project a name, select target language, and project type of STM32Cube

  • Make sure the Target Reference is correct as it can't be changed once the project is created, and the firmware package repository path is as expected. Set the Code Generator Options to reference library files, or copy library files in your project, depending on how you want to structure your project.
  • When you click Finish, the STM32CudeIDE will download the firmware library if required and unzip it to the repository location specified above. This file is typically 100's MB in size so this will take several minutes to complete.

Configuring the Project

The Device Configuration Tool with automatic code generation is used to define pin usage and other default modes of operation for the NUCLEO-L476. In addition there are some build and linker settings that may be required depending on the default project build configuration.

The pins and configuration provided here need to be tailored to the specific board/processor being used.

Device Configuration Tool

A 4-wire SPI bus is used to connect AD7124 to the NUCLEO-L476RG board, and a UART is used to provide the serial I/O for the console interface. An LED is also used to indicate activity. The following sections detail the configuration settings that need to be made for each of these.

SPI

SPI1 port on the processor is used to communicate with the AD7124, with the pin assigned to each function as shown here, with the corresponding label.

It is recommended that a pull-up resistor be used on the SPI MOSI to ensure it is never floating in an undefined logic state. This can be a resistor on the board to the logic supply, or internal to the processor if available.

The pin PB10 is used as a software controlled chips select for SP1, and so its mode must be set to GPIO_output, and set the user label to SPI1_NSS to match what is used in the platform driver file. The Connectivity ? SPI1 configuration settings are shown here.

DMA and interrupts are not used and don't need to be configured. The SPI1 GPIO Settings are as follows.

}

The GPIO settings for PB10 are as follows.
{{ :resources:tools-software:product-support-software:ad7124_example:ad7124_csb_gpio.png?400 |

Serial UART

The serial port uses USART2, and no DMA or interrupts need to be configured.

The USART2 GPIO settings are as shown.

GPIO

An LED is toggled on the NUCLEO-L476 board to indicate sampling and other activity. The activity LED is controlled by Port A, Pin 5, and needs to enabled as digital output to support this function.

Build Settings

The printf(…) function is used to print numbers formatted as floating point values in the terminal view. As this feature is often disabled by default due to the additional memory requirement, floating point support in printf(…) must be enabled. In the Project properties window, under 'C/C++ Build ? Settings ? MCU GCC linker ? Miscellaneous > Other Flags' add a '-u _printf_float' option.

There is also a checkbox option to enable this in the MCU Settings view as well, but doing it in the linker section, seems to prevent the code analysis feature in the SMT32CubeIDE reporting '%f' as not supported in the code editor window. There is no problem enabling it in both locations in STM32CubeIDE.

If there are other source or include directories that need to be added to support the project build, they should also be added to the relevant 'Include paths' in the MCU GCC Compiler section as required.

Linker Files

The default value for _estack may be incorrect in the *.ld files. This can cause problems when calling into certain library functions. In particular this can prevent the %f format specifier working with the floating point version of printf(…). If instead of a value like '1.23', the terminal output is '0.00', this can indicate a need to update the linker *.ld files. For the NUCLEO-L476RG, the RAM and the FLASH versions of the ld files contain the following:

/* Highest address of the user mode stack */
_estack = 0x20017fff; /* end of "RAM" Ram type memory */

Changing this as follows fixes the issues related to floating point support in printf:

/* Highest address of the user mode stack */
_estack = 0x20018000; /* end of "RAM" Ram type memory */

Source File Edits

When using the Device Configuration Tool, the code generator produces a two of these source files, main.c and main.h need minor edits to integrate the AD7124 example code. There may be an edit required to the _read(…) function in syscalls.c to work around an issue, but whether this is required, will depend on the specific library and build environment.

main.c

To keep the integration of the AD7124 example application with other user and platform specific code, there are only two functions that a user needs to call from their own code, typically as part of the main function.

  • ad7124_app_initialize(..) that does all the one-time initialization work required by the app, mainly AD7124 device setup
    • It is strongly recommended to test the return value from this function to determine if the initialization was successful or not
    • A value less than 0 indicate failure.
  /* Initialize the AD7124 application before the main loop */
int32_t setupResult;
if ((setupResult = ad7124_app_initialize(AD7124_CONFIG_A)) < 0 ) {
    // Handle error setting up AD7124 here
}
  • adi_do_console_menu(…) displays the user menu to interact with the application features
    • This can be called in a while(1) loop so that it is always displayed.
  while(1) {
    // display the console menu for the AD7124 application
    adi_do_console_menu(&ad7124_main_menu);
}
?

Both are defined in the “ad7124_console_app.h” header which needs to be added as #include file.

main.h

The AD7124 example assumes that all the STM32 hardware is initialized and appropriate SPI and UART port handles are available, and are used in platform_drivers.c and platform_support.c. The following extern declarations for the SPI and serial port handles are required in main.h to make them available to the platform specific code.

extern SPI_HandleTypeDef hspi1;
extern UART_HandleTypeDef huart2;
The names of the port handles are defined by the Device Configuration Tool based on the selected processor and pin choices. If using a different processor or pins, these may need to be changed in the platform_drivers.c and platform_support.c files so they match up.

syscalls.c

In the _read(…) function, the 'len' parameter passed in was found to always be '1024' for the library and build environment used to develop the example code.

int _read(int file, char *ptr, int len)

In order to support the use of getchar(), the expression 'len = 1;' was added immediately before the for loop in the _read(…) function. While this is sufficient for getchar() to work, it does not support use of other stdio.h functions such as scanf(…).

Adding AD7124 Example Files

The distribution of the AD7124 source and header files can be added to the project that has been created. The files can be added in a dedicated 'adi' directory, or in the main 'src' directory, or split as appropriate between 'src' and 'inc' directories, according to the file structure being used. If adding new source and header file locations, then these will need to be added to the build settings as necessary, in the relevant 'Include paths' in the MCU GCC Compiler configuration.

The platform_support.c/.h files provide the necessary definitions and declarations of io_getchar(…) and io_putchar(…) to read/write characters over the serial port to the connected terminal. If using a compiler other than GCC, or a different serial port than USART2 then there may be additional changes required to get serial I/O working. Examples included in the ST Firmware download can provide guidance.

At this point, assuming that any necessary changes, pin names, port usage/configuration have been made, the project should compile cleanly.

Hardware Connections

Power & USB

A 9V DC supply (barrel jack, center pin positive) is required to power the EVAl-AD7124-8SDZ evaluation board. The NUCLEO-476RG is powered via the USB connection to the PC, which also provides the serial UART connection back to the PC. The NUCLEO-476 creates a COM port that can be connected to by a terminal emulator, e.g. putty.

If you are unsure what COM port to use to communicate with the board, open Device Manager, and look under the 'Ports (COM & LPT)' node.

SPI Interface

SPI connections to the host processor board can be made to the relevant test points on the eval board, or more easily with an SDP Breakout Board.

AD7124 SPI Signal SDP Breakout Board NUCLEO-L476
GND 81 GND on CN5.7
SCLK 82 D3 (PB3) on CN9.4
DOUT/RDYB 83 D5 (PB4) on CN9.6
DIN 84 D4 (PB5) on CN9.5
CSB 85 D6 (PB10) on CN9.7

Analog Input

The screw terminal connections to J6 and J11 can be used to connect appropriate analog input signals to provide test stimulus to the AD7124.

In Configuration A

  • AIN0/AIN1 are used for channel 0, simple voltage measurement

In Configuration B

  • AIN2/AIN3 go to the A2 thermocouple connector on the evaluation board, and are captured on channel 0. This uses an internal reference and has a bias voltage enabled on AIN2. A suitable thermocouple should connected to A2 for this measurement.
  • AIN4/AIN5 are an RTD1000 measurement on channel 1. Excitation is provided from AIN1 for this. This requires an external RTD and reference resistor connected as show in the figure below.

Console Application

Once the hardware connections are made, and the compiled code programmed into the board, open the terminal program, and reset the hardware to see the AD7124 menu that allows a user to perform a variety of functions. These include reset the device, program one of the pre-defined configurations, and sample data that is displayed on screen or streamed so it can captured by the console.

下載該資料的人也在下載 下載該資料的人還在閱讀
更多 >

評論

查看更多

下載排行

本周

  1. 1電子電路原理第七版PDF電子教材免費下載
  2. 0.00 MB  |  1491次下載  |  免費
  3. 2單片機典型實例介紹
  4. 18.19 MB  |  95次下載  |  1 積分
  5. 3S7-200PLC編程實例詳細資料
  6. 1.17 MB  |  27次下載  |  1 積分
  7. 4筆記本電腦主板的元件識別和講解說明
  8. 4.28 MB  |  18次下載  |  4 積分
  9. 5開關電源原理及各功能電路詳解
  10. 0.38 MB  |  11次下載  |  免費
  11. 6100W短波放大電路圖
  12. 0.05 MB  |  4次下載  |  3 積分
  13. 7基于單片機和 SG3525的程控開關電源設計
  14. 0.23 MB  |  4次下載  |  免費
  15. 8基于AT89C2051/4051單片機編程器的實驗
  16. 0.11 MB  |  4次下載  |  免費

本月

  1. 1OrCAD10.5下載OrCAD10.5中文版軟件
  2. 0.00 MB  |  234313次下載  |  免費
  3. 2PADS 9.0 2009最新版 -下載
  4. 0.00 MB  |  66304次下載  |  免費
  5. 3protel99下載protel99軟件下載(中文版)
  6. 0.00 MB  |  51209次下載  |  免費
  7. 4LabView 8.0 專業版下載 (3CD完整版)
  8. 0.00 MB  |  51043次下載  |  免費
  9. 5555集成電路應用800例(新編版)
  10. 0.00 MB  |  33562次下載  |  免費
  11. 6接口電路圖大全
  12. 未知  |  30320次下載  |  免費
  13. 7Multisim 10下載Multisim 10 中文版
  14. 0.00 MB  |  28588次下載  |  免費
  15. 8開關電源設計實例指南
  16. 未知  |  21539次下載  |  免費

總榜

  1. 1matlab軟件下載入口
  2. 未知  |  935053次下載  |  免費
  3. 2protel99se軟件下載(可英文版轉中文版)
  4. 78.1 MB  |  537793次下載  |  免費
  5. 3MATLAB 7.1 下載 (含軟件介紹)
  6. 未知  |  420026次下載  |  免費
  7. 4OrCAD10.5下載OrCAD10.5中文版軟件
  8. 0.00 MB  |  234313次下載  |  免費
  9. 5Altium DXP2002下載入口
  10. 未知  |  233046次下載  |  免費
  11. 6電路仿真軟件multisim 10.0免費下載
  12. 340992  |  191183次下載  |  免費
  13. 7十天學會AVR單片機與C語言視頻教程 下載
  14. 158M  |  183277次下載  |  免費
  15. 8proe5.0野火版下載(中文版免費下載)
  16. 未知  |  138039次下載  |  免費
主站蜘蛛池模板: 羞羞答答dc视频| 亚洲一区精品伊人久久伊人| 麻豆产精品一二三产区区| 推倒美女总裁啪啪| 久久久免费观看| 久久精品无码一区二区日韩av| 久久精品日本免费线| 免费人妻无码AV不卡在线| 女性露出奶头流出精子| 久久国产欧美日韩精品免费| 国产在线播放KKK| 国产精彩视频在线| 国产在线播放精品视频| 久久久久久天天夜夜天天| 美国兽皇zoo在线播放| 青青视频国产色偷偷| 午夜不卡av免费| 一本之道高清在线观看一区| 91精品国产入口| 大乳牛奶女magnet| 狠狠色狠狠色综合日日2019| 玖玖热视频一区二区人妻| 久久亚洲免费视频| 欧美GAY猛男GAYA片18禁| 色-情-伦-理一区二区三区| 亚洲大片在线观看| 胸大美女又黄的网站| 在野外被男人躁了一夜动图| xxxx69日本| 国内精品乱码卡一卡2卡三卡| 久久亚洲欧美国产综合| 日本一本道高清码v| 亚洲欧美国产综合在线一区| 99视频福利| 国产亚洲精品久久久久久入口 | 无码人妻精品一区二区蜜桃色欲| 伊人草| 第一福利在线永久视频| 精品无码久久久久久国产百度| 欧美一夜爽爽爽爽爽爽| 日本无翼恶漫画大全优优漫画|