EVB开发板是什么意思
时间: 2023-08-21 18:14:37 浏览: 1184
EVB开发板是指一种用于嵌入式系统开发的开发板。EVB是Evaluation Board的缩写,意为评估板。它通常由硬件电路和相应的软件支持组成,用于评估和开发特定的嵌入式系统。EVB开发板可以提供外部供电方式,其中一种方式是通过外部适配器连接到EVB板上的电源插座进行供电,另一种方式是通过电脑的USB线连接到EVB板上的USB插座进行供电。通过这种供电方式,EVB开发板可以为系统模块和其他电路提供所需的电源电压。[1]
相关问题
S32K144-EVB开发板CAN实例代码
以下是S32K144-EVB开发板CAN实例代码:
```c
#include "S32K144.h"
#include "can.h"
#include "clocks_and_modes.h"
#include "gpio.h"
#include "interrupt_manager.h"
#define CAN0_TX_PIN 27U
#define CAN0_RX_PIN 26U
#define CAN0_TX_MUX 2U
#define CAN0_RX_MUX 2U
#define CAN0_RX_MSG_BUF_NUM (4U)
#define CAN0_BASE_ADDR (0x40024000U)
#define CAN0_RX_FIFO_ID (0x100U)
#define CAN0_RX_FIFO_NUM (8U)
static uint8_t can0RxMsgBuf[CAN0_RX_MSG_BUF_NUM][CAN_MESSAGE_BUFFER_MAX_PAYLOAD_SIZE];
void Can0_RxIsr(void);
void InitCan0(void)
{
/* Enable clock for PORTA */
PCC->PCCn[PCC_PORTA_INDEX] |= PCC_PCCn_CGC_MASK;
/* Configure CAN0_TX_PIN and CAN0_RX_PIN as alternative function (Alt2) */
PORTA->PCR[CAN0_TX_PIN] = PORT_PCR_MUX(CAN0_TX_MUX);
PORTA->PCR[CAN0_RX_PIN] = PORT_PCR_MUX(CAN0_RX_MUX);
/* Set the bit rate to 500 kbps with a 8 MHz clock */
const uint32_t can0ClkFreq = 8000000U;
const uint32_t baudRate = 500000U;
const uint32_t prescaler = (can0ClkFreq / (baudRate * 20U)) - 1U;
CAN0->CTRL1 &= ~CAN_CTRL1_CLKSRC_MASK;
CAN0->CTRL1 |= CAN_CTRL1_CLKSRC(1U);
CAN0->CTRL1 |= CAN_CTRL1_PRESDIV(prescaler);
/* Enable CAN0 */
PCC->PCCn[PCC_FlexCAN0_INDEX] |= PCC_PCCn_CGC_MASK;
/* Enable individual RX FIFO filters */
CAN0->MCR |= CAN_MCR_IRMQ_MASK;
/* Enable RX FIFO */
CAN0->MCR |= CAN_MCR_RFEN_MASK;
/* Configure RX FIFO ID filter */
CAN0->RXFIFO.IDTABLE[0] = 0x80000000U;
CAN0->RXFIFO.IDTABLE[1] = 0x80000000U;
/* Configure RX FIFO filter element */
CAN0->RXIMR[CAN0_RX_FIFO_NUM] = 0xFFFFFFFFU;
CAN0->RXMGMASK = 0x80000000U;
CAN0->RXFGMASK = 0x80000000U;
/* Enable RX FIFO interrupt */
CAN0->IMASK1 |= CAN_IMASK1_BUF5M_MASK;
/* Configure RX message buffers */
for (uint32_t msgBufIdx = 0U; msgBufIdx < CAN0_RX_MSG_BUF_NUM; msgBufIdx++)
{
/* Configure RX message buffer filter */
CAN0->RAMn[msgBufIdx].ID = (CAN_RAMn_ID_STD(0x7FFU) | CAN_RAMn_IDE_MASK);
/* Configure RX message buffer payload size */
CAN0->RAMn[msgBufIdx].CS = CAN_CS_DLC(CAN_MESSAGE_BUFFER_MAX_PAYLOAD_SIZE);
/* Configure RX message buffer for reception */
CAN0->RAMn[msgBufIdx].CS |= CAN_CS_CODE(CAN_CS_CODE_RX_INACTIVE);
}
/* Configure NVIC for RX FIFO interrupt */
const IRQn_Type can0RxIrqId = IRQ_CAN0_ORed_Message_buffer;
INT_SYS_EnableIRQ(can0RxIrqId);
INT_SYS_SetPriority(can0RxIrqId, 3U);
}
void Can0_RxIsr(void)
{
uint32_t msgBufIdx = 0U;
/* Read RX FIFO and dispatch messages */
while (CAN0->IFLAG1 & CAN_IFLAG1_BUF5I_MASK)
{
/* Clear RX FIFO interrupt flag */
CAN0->IFLAG1 |= CAN_IFLAG1_BUF5I_MASK;
/* Read RX FIFO element */
const uint32_t fifoElemIdx = 0U;
const uint32_t fifoElemAddr = (CAN0_BASE_ADDR + 0x00000C00U + (fifoElemIdx * 0x10U));
uint32_t fifoElemData[4] = {0U};
for (uint32_t i = 0U; i < 4U; i++)
{
fifoElemData[i] = (*(volatile uint32_t *)(fifoElemAddr + (i * 4U)));
}
/* Process RX FIFO element */
if ((fifoElemData[0] & CAN_RAMn_IDE_MASK) == CAN_RAMn_IDE_MASK)
{
/* Extended ID */
const uint32_t rxMsgId = (fifoElemData[0] & CAN_RAMn_ID_MASK_EXT);
const uint8_t rxMsgDlc = (fifoElemData[1] & CAN_RAMn_CS_DLC_MASK);
uint8_t rxMsgPayload[CAN_MESSAGE_BUFFER_MAX_PAYLOAD_SIZE] = {0U};
for (uint32_t i = 0U; i < (rxMsgDlc >> 2U); i++)
{
((uint32_t *)rxMsgPayload)[i] = fifoElemData[i + 2U];
}
/* Find free RX message buffer and configure it for reception */
for (msgBufIdx = 0U; msgBufIdx < CAN0_RX_MSG_BUF_NUM; msgBufIdx++)
{
if ((CAN0->RAMn[msgBufIdx].CS & CAN_CS_CODE_MASK) == CAN_CS_CODE_RX_INACTIVE)
{
break;
}
}
if (msgBufIdx < CAN0_RX_MSG_BUF_NUM)
{
/* Configure RX message buffer filter */
CAN0->RAMn[msgBufIdx].ID = (CAN_RAMn_ID_EXT(rxMsgId) | CAN_RAMn_IDE_MASK);
/* Configure RX message buffer payload size */
CAN0->RAMn[msgBufIdx].CS = CAN_CS_DLC(rxMsgDlc);
/* Configure RX message buffer for reception */
CAN0->RAMn[msgBufIdx].CS |= CAN_CS_CODE(CAN_CS_CODE_RX_FULL);
/* Copy RX message payload */
for (uint32_t i = 0U; i < CAN_MESSAGE_BUFFER_MAX_PAYLOAD_SIZE; i++)
{
can0RxMsgBuf[msgBufIdx][i] = rxMsgPayload[i];
}
}
else
{
/* RX message buffer not available */
}
}
else
{
/* Standard ID */
}
}
}
void SendCan0Msg(const uint32_t msgId, const uint8_t * const msgPayload, const uint32_t msgPayloadSize)
{
/* Find free TX message buffer and configure it for transmission */
uint32_t txMsgBufIdx = 0U;
for (txMsgBufIdx = 0U; txMsgBufIdx < CAN0_TX_MSG_BUF_NUM; txMsgBufIdx++)
{
if ((CAN0->RAMn[txMsgBufIdx].CS & CAN_CS_CODE_MASK) == CAN_CS_CODE_TX_INACTIVE)
{
break;
}
}
if (txMsgBufIdx < CAN0_TX_MSG_BUF_NUM)
{
/* Configure TX message buffer ID */
CAN0->RAMn[txMsgBufIdx].ID = (CAN_RAMn_ID_STD(msgId) | CAN_RAMn_IDE_MASK);
/* Configure TX message buffer payload size */
CAN0->RAMn[txMsgBufIdx].CS = CAN_CS_DLC(msgPayloadSize);
/* Copy TX message payload */
for (uint32_t i = 0U; i < msgPayloadSize; i++)
{
can0TxMsgBuf[txMsgBufIdx][i] = msgPayload[i];
}
/* Configure TX message buffer for transmission */
CAN0->RAMn[txMsgBufIdx].CS |= CAN_CS_CODE(CAN_CS_CODE_TX_INACTIVE);
}
else
{
/* TX message buffer not available */
}
}
int main(void)
{
/* Init board hardware */
InitClocksAndModes();
InitGpio();
InitCan0();
/* Send CAN message */
const uint32_t msgId = 0x123U;
const uint8_t msgPayload[] = {0x11U, 0x22U, 0x33U};
const uint32_t msgPayloadSize = sizeof(msgPayload);
SendCan0Msg(msgId, msgPayload, msgPayloadSize);
/* Main loop */
while (1U)
{
/* Do nothing */
}
}
```
这个例程中,我们使用了S32K144-EVB开发板上的CAN0模块,并且配置了一个接收FIFO和四个接收消息缓冲区。在初始化过程中,我们设置了CAN0的波特率为500 kbps,并且启用了CAN0模块和RX FIFO中断。在主函数中,我们发送了一个CAN消息,并且在接收中断处理函数Can0_RxIsr中读取并处理了接收到的CAN消息。
在Keil5环境下为W7500EVB开发板编写RGBLED闪烁程序的详细步骤和代码示例是什么?
在开发W7500EVB开发板上的RGBLED闪烁程序时,首先需要了解W7500的GPIO(通用输入输出)端口如何控制LED。依据《W7500开发板使用手册:从入门到实战》中的指导,你可以按照以下步骤进行操作:
参考资源链接:[W7500开发板使用手册:从入门到实战](https://wenku.csdn.net/doc/2qf7dotysm?spm=1055.2569.3001.10343)
1. 打开Keil5软件,创建一个新项目并选择对应的MCU型号。
2. 配置项目设置,包括晶振频率、编译器优化等级等。
3. 添加必要的库文件,这些文件可以在开发板提供的资源包中找到。
4. 编写代码,初始化RGBLED所连接的GPIO端口为输出模式,并设置相应的引脚电平以控制LED的亮灭。
5. 在主循环中,通过改变GPIO端口电平状态来实现LED的闪烁效果。
示例代码如下:
```c
#include
参考资源链接:[W7500开发板使用手册:从入门到实战](https://wenku.csdn.net/doc/2qf7dotysm?spm=1055.2569.3001.10343)
阅读全文