1062 views|4 replies

1237

Posts

66

Resources
The OP
 

[Jihai APM32F407 Tiny Board] 5. DSP library FFT test [Copy link]

 

The official demo does not have optimization turned on, and the burning is extremely slow after compilation. It is much faster after turning on O3 optimization.

#include "main.h"
#include "Board.h"
#include "stdio.h"

#include "apm32f4xx_gpio.h"
#include "apm32f4xx_misc.h"
#include "apm32f4xx_usart.h"


extern void DSPTestDemo(void);

uint32_t delay_init(void) 
{
	uint32_t c;

	/* Enable TRC */
	CoreDebug->DEMCR &= ~0x01000000;
	CoreDebug->DEMCR |=  0x01000000;

	/* Enable counter */
	DWT->CTRL &= ~0x00000001;
	DWT->CTRL |=  0x00000001;

	/* Reset counter */
	DWT->CYCCNT = 0;

	/* Check if DWT has started */
	c = DWT->CYCCNT;

	/* 2 dummys */
	__ASM volatile ("NOP");
	__ASM volatile ("NOP");

	/* Return difference, if result is zero, DWT has not started */
	return (DWT->CYCCNT - c);
}

void delay_ms(uint32_t ms) 
{
	uint32_t start = DWT->CYCCNT;
	/* Go to number of cycles for system */
	ms *= (SystemCoreClock / 1000);
	/* Delay till end */
	while ((DWT->CYCCNT - start) < ms);
}
int main(void)
{
    uint8_t keyType;
    
    /* Set system interrupt priority grouping */
    NVIC_ConfigPriorityGroup(NVIC_PRIORITY_GROUP_2);
    
    /* Init delay function */
    Delay_Init();

    /* Init LED */
    APM_MINI_LEDInit(LED2);
    APM_MINI_LEDInit(LED3);

    /* Init USART1 */
    USART1_Init(115200);

    /* Init KEY */
    APM_MINI_PBInit(BUTTON_KEY2, BUTTON_MODE_GPIO);
    APM_MINI_PBInit(BUTTON_KEY1, BUTTON_MODE_GPIO);

		delay_init();
    /* Wait board and module power on */
    delay_ms(200);
    
		uint32_t t1 = DWT->CYCCNT;
		DSPTestDemo();
		uint32_t t2 = DWT->CYCCNT;
		printf("time=%fus\n",(t2-t1)*1000000.0/SystemCoreClock);
		
    APM_MINI_LEDOn(LED3);
    
    while(1)
    {
        delay_ms(10);
    }
}


Without FPU, 2048-point FFT takes about 16.2ms. Test comparison by netizen stm32f407

I tried to add a macro definition to enable FPU, but the compilation failed.

__FPU_PRESENT = 1,__FPU_USED = 1

This post is from Domestic Chip Exchange

Latest reply

I mistook APM for AT a long time ago, and downloaded the example of Arteli. I just installed the SDK of Jihai and tried it. Adding the definition of __FPU_PRESENT=1,__FPU_USED=1 will result in the same error as yours. In this case, __FPU_USED is defined repeatedly. Can you add __FPU_PRESENT=1 without adding __FPU_USED=1? [attach]704230[/attach]   Details Published on 2023-6-9 20:40
 
 

6820

Posts

11

Resources
2
 
The test produced by the boss is indeed a profound one. Learned!
This post is from Domestic Chip Exchange
 
 
 

9702

Posts

24

Resources
3
 

I tried to define __FPU_PRESENT=1,__FPU_USED=1 in the MDK project of the Firmware Library routine and it can be compiled

The compilation warning is because __FPU_PRESENT is defined in at32f403a_407.h

This post is from Domestic Chip Exchange

Comments

Try again  Details Published on 2023-6-8 21:58
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

1237

Posts

66

Resources
4
 
littleshrimp posted on 2023-6-5 11:24 I tried to define __FPU_PRESENT=1,__FPU_USED=1 in the MDK project of the Firmware Library routine and it can be compiled...

Try again

This post is from Domestic Chip Exchange

Comments

I mistook APM for AT before, and downloaded the Yatli routine. I just installed the Jihai SDK and tried it. Adding __FPU_PRESENT=1,__FPU_USED=1 definitions will result in the same error as yours. This is probably because __FPU_USED is defined repeatedly. Try adding only __FPU_PRESENT=1 without adding __FPU_USE  Details Published on 2023-6-9 20:40
 
 
 

9702

Posts

24

Resources
5
 

I mistook APM for AT a long time ago, and downloaded the example of Arteli. I just installed the SDK of Jihai and tried it. Adding the definition of __FPU_PRESENT=1,__FPU_USED=1 will result in the same error as yours.

In this case, __FPU_USED is defined repeatedly. Can you add __FPU_PRESENT=1 without adding __FPU_USED=1?

This post is from Domestic Chip Exchange
Personal signature虾扯蛋,蛋扯虾,虾扯蛋扯虾
 
 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list