超低功耗Mcu PT32L007 测试板免费领
PT32L007超低功耗MCU
64K FLASH16k RAM
TSSOP20QFN20 封装,兼容HC32L110,PIN TO PIN
参考手册,见附件文档, 测试板原理图,见附件
有啥特色没有??
引脚好少啊 wzjhuohua 发表于 2024-2-28 08:28
有啥特色没有??
超低功耗,flash64Kram 16K qintian0303 发表于 2024-2-28 08:37
引脚好少啊
是的,针对小引脚,多引脚的有PT32L076,PT32L076xx是基于Cortex-M0内核的一款32位高性能MCU,最高主频支持64MHz,Flash 64/128Kbyte, RAM 16/32Kbyte, 支持工作电压1.8~5.5v, 工作温度为-40~+105度。支持外部4~25MHz高速晶体振荡器及32.768KHz低速晶体振荡器,支持内部32MHz高速RC振荡器及32K/38.4K低速RC振荡器,支持PLL倍频。内部集成了6通道DMA控制器,4路 UART,2路LPUART,2路SPI,2路I2C等丰富的串口外设,12位1M采样率的SARADC,支持26个外部通道,多达11个定时器,其中包括1 个 16 位带死区控制和紧急刹车,用于电机控制的高级控制定时器 TIM1,1 个 16 位用于辅助电机控制的高级控制定时器 TIM8,3个16位通用定时器TIM5/6/7, 2个16位基本定时器TIM2/3, 1个16位低功耗定时器TIM4,1个可用于低功耗下电机控制TIM10,1个独立看门狗1个窗口看门狗。支持液晶显示LCD接口,其中包括2*42、4*40、6*38及8*36等,支持7位DAC,4路比较器,4路运算放大器。部分IO大电流驱动功能。支持Sleep模式和Deep Sleep模式。支持AES128/192/256, 乘法器&除法器,低电压检测功能,看门狗唤醒,芯片内部唯一码,CRC校验等功能。
看起来没低功耗 lpuart,没有异步工作的低功耗 timer ,但是为啥叫超低功耗? 怎么领,在哪儿领老哥 可以的,发我地址,我快递给您,运费到付 wzjhuohua 发表于 2024-2-28 08:28
有啥特色没有??
大众化才是最好的, xch 发表于 2024-2-28 12:12
看起来没低功耗 lpuart,没有异步工作的低功耗 timer ,但是为啥叫超低功耗? ...
详细数据手册,请查收!
什么内核?
有MCU具体需求的可联系 可联系电话15332235813;微信号:daishishuai3。 gyh974 发表于 2024-2-29 10:28
什么内核?
M0内核 wangxiangtan2 发表于 2024-2-29 08:34
怎么领,在哪儿领老哥
TEL/VX:18566239000
渠道多多,多多关注
/******************************************************************************
* @file PT32x007x_uart.c
* @author应用开发团队
* @version V1.5.0
* @date 2023/11/20
* @brief This file provides firmware functions to manage the following
* functionalities of the Universal synchronous asynchronous receiver
* transmitter (USART):
* + Initialization and Configuration
* + STOP Mode
* + BaudRate
* + Data transfers
* + Multi-Processor Communication
* + Half-duplex mode
* + Smartcard mode
* + Interrupts and flags management
*
******************************************************************************
* @attention
*
*
*****************************************************************************/
/* Includes ------------------------------------------------------------------*/
#include "PT32x007x_uart.h"
/** @defgroup UART
* @brief UART driver modules
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/\
#define Init_CR_MASK (u32)0xFFFFFE80
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/**
* @briefInitializes the UARTx peripheral according to the specified
* parameters in the USART_InitStruct .
* @paramUARTx: where x can be from 0 to 1 to select the UART peripheral.
* @paramUART_InitStruct: pointer to a UART_InitTypeDef structure that contains
* the configuration information for the specified UART peripheral.
* @retval None
*/
void UART_Init(UART_TypeDef* UARTx, UART_InitTypeDef* UART_InitStruct)
{
u32tmpreg = 0, remainder = 0,quotient = 0, pclk = 0;
/* Check the parameters */
assert_param(IS_UART_ALL_PERIPH(UARTx));
assert_param(IS_UART_BaudRate(UART_InitStruct->UART_BaudRate));
assert_param(IS_UART_WordLengthAndParity(UART_InitStruct->UART_WordLengthAndParity));
assert_param(IS_UART_StopBitLength(UART_InitStruct->UART_StopBitLength));
assert_param(IS_UART_ParityMode(UART_InitStruct->UART_ParityMode));
assert_param(IS_UART_Receiver(UART_InitStruct->UART_Receiver));
assert_param(IS_UART_LoopbackMode(UART_InitStruct->UART_LoopbackMode));
UARTx->RXFR = UART_RXFR_RXFR;
UARTx->TXFR = UART_TXFR_TXFR;
tmpreg &= Init_CR_MASK;
tmpreg |=(UART_InitStruct ->UART_WordLengthAndParity| \
UART_InitStruct ->UART_StopBitLength | \
UART_InitStruct ->UART_ParityMode | \
UART_InitStruct->UART_LoopbackMode | \
UART_InitStruct->UART_Receiver);
UARTx->CR = tmpreg;
pclk = RCC_GetClockFreq(RCC_PCLK);
quotient =(pclk / (16 * UART_InitStruct->UART_BaudRate));
remainder = (pclk % (16 * UART_InitStruct->UART_BaudRate));
if(quotient==0)
{
UARTx->BRR=1;
}
else
{
if (remainder > (8 * UART_InitStruct->UART_BaudRate))
{
UARTx->BRR = (u16) (quotient + 1);
}
else
{
UARTx->BRR = (u16) quotient;
}
}
}
/**
* @briefFills each UART_InitStruct member with its default value.
* @paramUART_InitStruct: pointer to a UART_InitTypeDef structure
* which will be initialized.
* @retval None
*/
void UART_StructInit(UART_InitTypeDef* UART_InitStruct)
{
/* USART_InitStruct members default value */
UART_InitStruct->UART_BaudRate = 19200;
UART_InitStruct->UART_WordLengthAndParity = UART_WordLengthAndParity_8DP;
UART_InitStruct->UART_StopBitLength = UART_StopBitLength_1;
UART_InitStruct->UART_ParityMode = UART_ParityMode_Odd;
UART_InitStruct->UART_Receiver = UART_Receiver_Enable;
UART_InitStruct->UART_LoopbackMode = UART_LoopbackMode_Disable;
}
/**
* @briefEnables or disables the specified UART peripheral.
* @paramUARTx: where x can be from 0 to 1 to select the UART peripheral.
* @paramNewState: new state of the USARTx peripheral.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void UART_Cmd(UART_TypeDef* UARTx, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_UART_ALL_PERIPH(UARTx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable the selected USART by setting the UE bit in the CR1 register */
UARTx->CR |= UART_CR_EN;
}
else
{
/* Disable the selected USART by clearing the UE bit in the CR1 register */
UARTx->CR &= (~UART_CR_EN);
}
}
/**
* @briefTransmits single data through the UARTx peripheral.
* @paramUARTx: where x can be from 0 or 1 to select the UART peripheral.
* @paramData: the data to transmit.
* @retval None
*/
void UART_SendData(UART_TypeDef* UARTx, u16 Data)
{
/* Check the parameters */
assert_param(IS_UART_ALL_PERIPH(UARTx));
assert_param(IS_UART_DATA(Data));
/* While the TxFIFO contain 8 characters. */
while((UARTx->SR & UART_SR_TXF));
/* Transmit Data */
UARTx->DR = (Data & (u16)0x01FF);
}
/**
* @briefReturns the most recent received data by the UARTx peripheral.
* @paramUARTx: where x can be from 0 to 1 to select the UART peripheral.
* @retval The received data.
*/
u16 UART_ReceiveData(UART_TypeDef* UARTx)
{
/* Check the parameters */
assert_param(IS_UART_ALL_PERIPH(UARTx));
/* Receive Data */
return (u16)(UARTx->DR & (u16)0x01FF);
}
/**
* @briefThis function reset the Rx and the Tx FIFOs
* @paramUARTx: where x can be from 0 to 1 to select the UART peripheral.
* @paramFIFO: Transmit FIFO or receive FIFO for the UART .
* This parameter can be:
* @ARG Rx_FIFO: Receive FIFO .
* @arg Tx_FIFO: Transmit FIFO .
* @retval None.
*/
void UART_FifoReset(UART_TypeDef* UARTx, u8 UART_FIFO)
{
assert_param(IS_UART_ALL_PERIPH(UARTx));
assert_param(IS_UART_FIFO(UART_FIFO));
switch (UART_FIFO)
{
case FIFO_RX :
UARTx->RXFR = UART_RXFR_RXFR;
break;
case FIFO_TX :
UARTx->TXFR = UART_TXFR_TXFR;
break;
}
}
/**
* @briefEnables or disables the UART's Half Duplex communication.
* @paramUARTx: where x can be from 0 to 1 to select the UART peripheral.
* @paramNewState: new state of the UART Communication.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void UART_HalfDuplexCmd(UART_TypeDef* UARTx, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_UART_ALL_PERIPH(UARTx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable the Half-Duplex mode by setting the OWE bit in the CR register */
UARTx->CR |= UART_CR_SLME;
}
else
{
/* Disable the Half-Duplex mode by clearing the OWE bit in the CR register */
UARTx->CR&= (u32)~((u32)UART_CR_SLME);
}
}
/**
* @briefEnables or disables the UART's transmitter or receiver.
* @paramUARTx: where x can be from 0 to 1 to select the UART peripheral.
* @paramUART_Direction: specifies the UART direction.
* This parameter can be any combination of the following values:
* @arg UART_SingleLineDirection_Tx: UART Single Line Direction Transmitter
* @arg UART_SingleLineDirection_Rx: UART Single Line Direction Receiver
* @paramNewState: new state of the USART transfer direction.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void UART_HalfDuplexDirectionConfig(UART_TypeDef* UARTx, u32 Direction)
{
/* Check the parameters */
assert_param(IS_UART_ALL_PERIPH(UARTx));
assert_param(IS_UART_SingleLineDirection(Direction));
if (Direction != UART_SingleLineDirection_Rx)
{
/* Set NSS pin internally by software */
UARTx->CR |= UART_SingleLineDirection_Tx;
}
else
{
/* Reset NSS pin internally by software */
UARTx->CR &= ~UART_SingleLineDirection_Tx;
}
}
/**
* @briefEnables or disables the UART's IrDA interface.
* @paramUARTx: where x can be 0 to select the UART peripheral.
* @paramNewState: new state of the IrDA mode.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void UART_IrDACmd(UART_TypeDef* UARTx, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_UART_ALL_PERIPH(UARTx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable the IrDA mode by setting the IRE bit in the IMCR register */
UARTx->IMCR |= UART_IMCR_IRE;
}
else
{
/* Disable the IrDA mode by clearing the EN bit in the IMCR register */
UARTx->IMCR &= ~UART_IMCR_IRE;
}
}
/**
* @briefConfigures the IrDA's Pin polarity
* @paramUARTx: where x can be 0 to select the UART peripheral.
* @paramNewState: new defined levels for the USART data.
* This parameter can be:
* @arg ENABLE: pin(s) signal values are inverted (Vdd =0, Gnd =1).
* @arg pin(s) signal works using the standard logic levels (Vdd =1, Gnd =0).
* @NOTE This function has to be called before calling UART_Cmd() function.
* @retval None
*/
void UART_IrDAPolarityConfig(UART_TypeDef* UARTx, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_UART_ALL_PERIPH(UARTx));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
/* Enable the binary data inversion feature by setting the DATAINV bit in
the CR2 register */
UARTx->IMCR |= UART_IMCR_IRPN;
}
else
{
/* Disable the binary data inversion feature by clearing the DATAINV bit in
the CR2 register */
UARTx->IMCR &= ~UART_IMCR_IRPN;
}
}
/**
* @briefSets the infrared duty cycle for UART peripheral.
* @paramUARTx: where x can be 0 to select the UART peripheral.
* @paramIrDADutyCycle: specifies the infrared duty cycle.
* @note This function has to be called before calling UART_Cmd() function.
* @retval None
*/
void UART_IrDADutyCycleConfig(UART_TypeDef* UARTx, u16 IrDADutyCycle)
{
/* Check the parameters */
assert_param(IS_UART_ALL_PERIPH(UARTx));
assert_param(IS_UART_InfraredDutyCycle(IrDADutyCycle));
/* Clear the IrDA's modulation PWM duty cycle */
UARTx->IMDCR &= ~UART_IMDCR_DUTY;
/* Set the IrDA's modulation PWM duty cycle*/
UARTx->IMDCR |= IrDADutyCycle;
}
/**
* @briefEnables or disables the specified USART interrupts.
* @paramUARTx: where x can be from 1 to 8 to select the USART peripheral.
* @paramUART_IT: specifies the UART interrupt sources to be enabled or disabled.
* This parameter can be one of the following values:
* @arg UART_IT_RXNEI: specifies the interrupt source for Receiver FIFO buffer non-empty interrupt.
* @arg UART_IT_RXFI: specifies the interrupt source for Receiver FIFO buffer full interrupt.
* @arg UART_IT_PEI: specifies the interrupt source for Parity error interrupt.
* @arg UART_IT_FEI: specifies the interrupt source for Frame error interrupt.
* @arg UART_IT_OVRI: specifies the interrupt source for Receiver FIFO buffer overflow interrupt.
* @arg UART_IT_TXEI: specifies the interrupt source for Transmitter FIFO buffer empty interrupt.
* @arg UART_IT_TXFI: specifies the interrupt source for Transmitter FIFO buffer full interrupt.
* @arg UART_IT_TXOI: specifies the interrupt source for Transfer end interrupt
* @paramNewState: new state of the specified USARTx interrupts.
* This parameter can be: ENABLE or DISABLE.
* @retval None
*/
void UART_ITConfig(UART_TypeDef* UARTx, u32 UART_IT, FunctionalState NewState)
{
/* Check the parameters */
assert_param(IS_UART_ALL_PERIPH(UARTx));
assert_param(IS_UART_IT(UART_IT));
assert_param(IS_FUNCTIONAL_STATE(NewState));
if (NewState != DISABLE)
{
UARTx->IE |= UART_IT;
}
else
{
UARTx->IE &= ~UART_IT;
}
}
/**
* @briefChecks whether the specified UART flag is set or not.
* @paramUARTx: where x can be from 0 to 1 to select the UART peripheral.
* @paramUART_FLAG: specifies the flag to check.
* This parameter can be one of the following values:
* @arg UART_FLAG_RXNE: Receiver FIFO not empty flag.
* @arg UART_FLAG_RXF: Receiver FIFO full flag.
* @arg UART_FLAG_PE: Parity error flag.
* @arg UART_FLAG_FE: Frame error flag.
* @arg UART_FLAG_OVR: Receiver FIFO buffer overflow flag.
* @arg UART_FLAG_TXE: Transmitter FIFO empty flag.
* @arg UART_FLAG_TXF: Transmitter FIFO full flag.
* @arg UART_FLAG_TXO: Transfer end flag.
* @retval The new state of UART_FLAG (SET or RESET).
*/
FlagStatus UART_GetFlagStatus(UART_TypeDef* UARTx, u32 UART_FLAG)
{
FlagStatus bitstatus = RESET;
/* Check the parameters */
assert_param(IS_UART_ALL_PERIPH(UARTx));
assert_param(IS_UART_FLAG(UART_FLAG));
if ((UARTx->SR & UART_FLAG) != (u16)RESET)
{
bitstatus = SET;
}
else
{
bitstatus = RESET;
}
return bitstatus;
}
/**
* @briefClears the UARTx's pending flags.
* @paramUARTx: where x can be from 0 to 1 to select the USART peripheral.
* @paramUSART_FLAG: specifies the flag to clear.
* This parameter can be any combination of the following values:
* @arg UART_FLAG_PE: Parity error flag.
* @arg UART_FLAG_FE: Frame error flag.
* @arg UART_FLAG_OVR: Receiver FIFO buffer overflow flag.
* @retval None
*/
void UART_ClearFlag(UART_TypeDef* UARTx, u32 UART_FLAG)
{
/* Check the parameters */
assert_param(IS_UART_ALL_PERIPH(UARTx));
assert_param(IS_UART_FLAG(UART_FLAG));
if(UART_FLAG==UART_FLAG_PE || UART_FLAG==UART_FLAG_FE || UART_FLAG==UART_FLAG_OVR)
{
UARTx->SR = UART_FLAG;
}
}
/**
* @briefChecks whether the specified UART intterrupt status is set or not.
* @paramUARTx: where x can be from 0 to 1 to select the USART peripheral.
* @paramUART_IT: Specify the intterrupt status to be checked.
* This parameter can be one of the following values:
* @arg UART_IT_RXNEI: specifies the interrupt source for Receiver FIFO buffer non-empty interrupt.
* @arg UART_IT_RXFI: specifies the interrupt source for Receiver FIFO buffer full interrupt.
* @arg UART_IT_PEI: specifies the interrupt source for Parity error interrupt.
* @arg UART_IT_FEI: specifies the interrupt source for Frame error interrupt.
* @arg UART_IT_OVRI: specifies the interrupt source for Receiver FIFO buffer overflow interrupt.
* @arg UART_IT_TXEI: specifies the interrupt source for Transmitter FIFO buffer empty interrupt.
* @arg UART_IT_TXFI: specifies the interrupt source for Transmitter FIFO buffer full interrupt.
* @arg UART_IT_TXOI: specifies the interrupt source for Transfer completed interrupt
* @return ITStatus of UART_IT (SET or RESET).
*/
ITStatus UART_GetITStatus(UART_TypeDef* UARTx, u32 UART_IT)
{
ITStatus bitstatus = RESET;
u32 enablestatus = 0;
/* Check the parameters */
assert_param(IS_UART_ALL_PERIPH(UARTx));
assert_param(IS_UART_IT(UART_IT));
/**/
enablestatus = (u32)(UARTx->IE & UART_IT);
/**/
if (((u32)(UARTx->SR & UART_IT) != (u32)RESET) && (enablestatus != (u32)RESET))
{
/* */
bitstatus = SET;
}
else
{
/* */
bitstatus = RESET;
}
/**/
returnbitstatus;
}
/**
* @}
*/
我要一块 VX:19924580103
页:
[1]
2