CH32V307 IO翻转速度测试
记录RISC-V MCU CH32V307 IO极限翻转速度。
测试代码如下:
/*********************************************************************
* @fn GPIO_Toggle_INIT
*
* @brief Initializes GPIOA.0
*
* @return none
*/
void GPIO_Toggle_INIT(void)
{
GPIO_InitTypeDef GPIO_InitStructure = {0};
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_2MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
}
/*********************************************************************
* @fn main
*
* @brief Main program.
*
* @return none
*/
int main(void)
{
USART_Printf_Init(115200);
printf("SystemClk:%d\r\n", SystemCoreClock);
printf("GPIO Toggle TEST\r\n");
GPIO_Toggle_INIT();
asm("li t0,1");
asm("li t2,1");
asm("li t1,0x4001080c");
while(1)
{
// asm("sw t0,(t1)");
// asm("sw zero,(t1)");
// asm("sw t0,(t1)");
// asm("xori t0,t0,1");
// asm("xor t0,t0,t2");
// GPIOA->OUTDR ^= GPIO_Pin_0;
GPIOA->OUTDR = 1;
GPIOA->OUTDR = 0;
}
}
标签:InitStructure,t0,GPIOA,CH32V307,IO,GPIO,asm,翻转
From: https://www.cnblogs.com/wahahahehehe/p/16822593.html