[sdk] updated sdk version: pec930_sdk-PEC930_SDK_v1.0.0-RC1

This commit is contained in:
Roy_01
2026-03-20 14:48:24 +08:00
parent 54c099819f
commit adb5c3eb2d
494 changed files with 8455 additions and 22700 deletions
+50 -32
View File
@@ -16,16 +16,36 @@
//=============================================================================
// Constant Definition
//=============================================================================
uint16_t rxDataBuffer[256];
uint16_t rxCounter = 0;
uint16_t rxData = 0;
uint16_t errCounter = 0;
uint16_t rightCounter = 0;
/* UART0-TX GPIO pins are PA1 PA15 PB3 PB4
* GPIO reuse are GPIO_AF_1
* GPIO pins are PA0 PB0 PB5
* GPIO reuse are GPIO_AF_2
* UART0-RX GPIO pins are PA0 PB0 PB5
* GPIO reuse are GPIO_AF_1
* GPIO pins are PA1 PA15 PB4
* GPIO reuse are GPIO_AF_2
*/
/* adjustment Instructions for the GPIOs */
#define CONFIG_UART_IO_TX_PORT GPIOA
#define CONFIG_UART_IO_TX_PIN GPIO_Pin_01
#define CONFIG_UART_IO_TX_AF_MODE GPIO_AF_1
#define CONFIG_UART_IO_RX_PORT GPIOA
#define CONFIG_UART_IO_RX_PIN GPIO_Pin_00
#define CONFIG_UART_IO_RX_AF_MODE GPIO_AF_1
/* Use Baud Rate */
#define CONFIG_BAUD_RATE_VALUE 38400
//=============================================================================
// Macro Definition
//=============================================================================
uint16_t rxDataBuffer[256];
uint16_t rxCounter = 0;
uint16_t rxData = 0;
uint16_t txData = 0;
uint16_t errCounter = 0;
uint16_t rightCounter = 0;
//=============================================================================
// Structure Definition
//=============================================================================
@@ -43,32 +63,34 @@ uint16_t rightCounter = 0;
//=============================================================================
int main(void)
{
/* Configure the system clock */
SYSCFG_ClkInitTypeDef SysClkInit = {0};
SysClkInit.ClkSource = SYSCFG_ClkSrc_HSI;
SysClkInit.ClkSource = SYSCFG_ClkSrc_HSI;
SYSCFG_SysClkConfig(&SysClkInit);
GPIO_InitTypeDef gpio_init = {0};
UART_InitTypeDef uart_init = {0};
/* Configure GPIO Pin mux of UART */
GPIO_InitTypeDef GpioInit = {0};
GpioInit.GPIO_Pin = CONFIG_UART_IO_TX_PIN; //UART0-TX
GpioInit.GPIO_Mode = GPIO_Mode_AF;
GpioInit.GPIO_AF_Mode = CONFIG_UART_IO_TX_AF_MODE;
GPIO_Init(CONFIG_UART_IO_TX_PORT, &GpioInit);
GpioInit.GPIO_Pin = CONFIG_UART_IO_RX_PIN; //UART0-RX
GpioInit.GPIO_AF_Mode = CONFIG_UART_IO_RX_AF_MODE;
GPIO_Init(CONFIG_UART_IO_RX_PORT, &GpioInit);
/* ToDo: configure GPIO Pin mux of UART (Tx through PA0?) */
gpio_init.GPIO_Pin = GPIO_Pin_00 | GPIO_Pin_01 ;
gpio_init.GPIO_Mode = GPIO_Mode_AF;
gpio_init.GPIO_AF_Mode = GPIO_AF_1;
GPIO_Init(GPIOA, &gpio_init);
uart_init.BaudRate = 115200;
uart_init.WordLength = UART_WordLength_8b;
uart_init.StopBits = UART_StopBits_1;
uart_init.Parity = UART_Parity_No;
uart_init.Mode = UART_Mode_TxRx;
UART_Init(UART0, &uart_init);
/* Configure the parameters of UART */
UART_InitTypeDef UartInit = {0};
UartInit.BaudRate = CONFIG_BAUD_RATE_VALUE;
UartInit.WordLength = UART_WordLength_8b;
UartInit.StopBits = UART_StopBits_1;
UartInit.Parity = UART_Parity_No;
UartInit.Mode = UART_Mode_TxRx;
UART_Init(UART0, &UartInit);
/* UART enable */
UART_Start(UART0);
for(rxCounter = 0; rxCounter < 256 ;rxCounter ++)
{
for(rxCounter = 0; rxCounter < 256; rxCounter ++)
rxDataBuffer[rxCounter] = rxCounter;
}
while(1)
{
@@ -77,17 +99,13 @@ int main(void)
rxData = UART_ReceiveData(UART0);
UART_ResetRxFIFO(UART0);
if(rxData != rxDataBuffer[rxData])
{
printf("rx error");
errCounter ++;
}
errCounter++;
else
{
UART_SendData(UART0,rxData);
UART_SendData(UART0, rxData);
UART_WaitTxFifoEmpty(UART0);
rightCounter ++ ;
rightCounter++;
}
}
}
}