当前位置: 首页 > news >正文

S32DS for ARM GPIO实践

S32DS操作:
一、新建项目
打开S32DS,FIle–>NEW–> S32DS Application Project选择对应芯片,写入项目名然后下一步
在这里插入图片描述选择对应的SDK,Debugger选带有PE字眼的,点击完成
在这里插入图片描述配置GPIO,双击Components界面下的pin_mux,在弹出的界面里面找到GPIO选项卡,找到想要配置的pin,选择输入或者输出
在这里插入图片描述我这里配置了TPC6为输出模式,然后右键Pin/Signal Selection的PTC6,打开Pin Functional Properties
在这里插入图片描述
在这里插入图片描述这里配置PTC6的所有配置:
interrupt status field 中断状态标准位 ——不修改 清晰的标志位
interrupt configuration field 中断触发方式 (ISF)----------失能、DMA、上升沿、下降沿、上升下降沿 、逻辑1、逻辑0。
pin Mux field- ----------IO复用
lock Field---------锁控制
pull enable fieled---------推挽使能
pull select field-----------选择上拉还是下拉
initial value field---------- 默认输出状态
digital filter field ----------数字滤波器

二、生成配置
配置完成后,保存后点击这里生成配置代码,生成的代码会在Grenerated_Code文件夹下
在这里插入图片描述在这里插入图片描述
三、代码初始化
S32DS生成的代码只生成了配置,不会想STM32MX一样把我们把初始化写到main里面,所有需要我们自己去写
默认配置下,我们系统时钟用的是高速的内部时钟
在clockman1里面可以查看
在这里插入图片描述

这个是S32时钟初始化的代码

CLOCK_SYS_Init(g_clockManConfigsArr,CLOCK_MANAGER_CONFIG_CNT,g_clockManCallbacksArr,CLOCK_MANAGER_CALLBACK_CNT);
CLOCK_SYS_UpdateConfiguration(0U,CLOCK_MANAGER_POLICY_AGREEMENT);

这个是GPIO初始化的代码以及写函数

PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);
PINS_DRV_WritePin(PTC,6,1); //写PTC6为1

这个是我的main函数

/* ###################################################################
**     Filename    : main.c
**     Processor   : S32K1xx
**     Abstract    :
**         Main module.
**         This module contains user's application code.
**     Settings    :
**     Contents    :
**         No public methods
**
** ###################################################################*/
/*!
** @file main.c
** @version 01.00
** @brief
**         Main module.
**         This module contains user's application code.
*/         
/*!
**  @addtogroup main_module main module documentation
**  @{
*/         
/* MODULE main *//* Including necessary module. Cpu.h contains other modules needed for compiling.*/
#include "Cpu.h"volatile int exit_code = 0;/* User includes (#include below this line is not maintained by Processor Expert) */void delay(volatile int x){while(x--);}
/*! \brief The main function for the project.\details The startup initialization sequence is the following:* - startup asm routine* - main()
*/
int main(void)
{delay(500);/* Write your local variable definition here *//*** Processor Expert internal initialization. DON'T REMOVE THIS CODE!!! ***/#ifdef PEX_RTOS_INITPEX_RTOS_INIT();                   /* Initialization of the selected RTOS. Macro is defined by the RTOS component. */#endif/*** End of Processor Expert internal initialization.                    ***/CLOCK_SYS_Init(g_clockManConfigsArr,CLOCK_MANAGER_CONFIG_CNT,g_clockManCallbacksArr,CLOCK_MANAGER_CALLBACK_CNT);CLOCK_SYS_UpdateConfiguration(0U,CLOCK_MANAGER_POLICY_AGREEMENT);PINS_DRV_Init(NUM_OF_CONFIGURED_PINS, g_pin_mux_InitConfigArr);while(1){PINS_DRV_WritePin(PTC,6,1); delay(500);PINS_DRV_WritePin(PTC,6,0); }/* Write your code here *//* For example: for(;;) { } *//*** Don't write any code pass this line, or it will be deleted during code generation. ***//*** RTOS startup code. Macro PEX_RTOS_START is defined by the RTOS component. DON'T MODIFY THIS CODE!!! ***/#ifdef PEX_RTOS_STARTPEX_RTOS_START();                  /* Startup of the selected RTOS. Macro is defined by the RTOS component. */#endif/*** End of RTOS startup code.  ***//*** Processor Expert end of main routine. DON'T MODIFY THIS CODE!!! ***/for(;;) {if(exit_code != 0) {break;}}return exit_code;/*** Processor Expert end of main routine. DON'T WRITE CODE BELOW!!! ***/
} /*** End of main routine. DO NOT MODIFY THIS TEXT!!! ***//* END main */
/*!
** @}
*/
/*
** ###################################################################
**
**     This file was created by Processor Expert 10.1 [05.21]
**     for the NXP S32K series of microcontrollers.
**
** ###################################################################
*/

http://www.mrgr.cn/news/56792.html

相关文章:

  • 平衡二叉树底层结构——AVL树
  • Kibana可视化Dashboard如何基于字段是否包含某关键词进行过滤
  • IIC通信与MAX30102采集血样数据+V4L2框架
  • 每日算法一练:剑指offer——数组篇(3)
  • 深度学习(一)基础:神经网络、训练过程与激活函数(1/10)
  • 算法:KMP算法详解
  • 基于Spring Boot的论坛网站:从零到部署
  • TensorRT构建的engine文件用途
  • 自动化数据库管理:如何通过存储过程动态创建 MySQL 对象
  • 网盘与移动硬盘优势对比
  • 请求转发和重定向
  • 动态规划20:918. 环形子数组的最大和
  • 私募基金大屏粒子效果和动画闪烁效果 vue3+js
  • 4步教你绘制流程图,轻松提高工作效率!
  • PL/I语言的起源?有C语言,有B语言和A语言吗?为什么shell脚本最开始可能有#!/bin/bash字样?为什么不支持嵌套注释?
  • javascript实现sha256算法,支持分多次计算
  • 黑马javaWeb笔记重点备份11:Web请求与响应
  • 找剪辑中的BGM、音效,就上这8个网站
  • 想让服务端请求更高效?为什么说alova比axios更胜一筹?
  • C++11
  • 我与Linux的爱恋:进程程序替换
  • 人工智能岗位英语面试 - 如何确保模型的可靠性和性能
  • QT界面开发:图形化设计、资源文件添加
  • SegFormer模型实现医学影像图像分割
  • 记一行代码顺序引起的事故
  • 梳理一下spring中,与message相关的知识点