【XMC4800 Relax EtherCAT Kit Review】+Build a new project and experience the powerful DAVE[Copy link]
This post was last edited by tdatd on 2019-1-14 15:34 All previous experiments were directly imported from Infineon's demo. I have a preliminary understanding of the power of Dave and the advanced process of IDE code generation. The era of using registers to write microcontroller registers seems to be gone, just like using st's cube to directly generate stm32 library files, and the bottom layer basically does not need to be written. Through this experiment, I also realized the powerful functions of Dave, directly configuring the hardware and automatically generating code. As an engineer, I always feel that I can be solid if I master it from scratch. Sometimes when I encounter problems that cannot be solved, I often suggest a new project to test it. I think I can generate the basic functions of FreRTOS through IDE, enable 2 tasks and drive LED1 LED2 respectively. Start Dave, which is based on the eclipse interface. Note that the directory of the workspace cannot have Chinese characters, spaces, etc. Then create a new Dave project. If it is not a Dave project, many integrated advanced configuration functions are probably not easy to use.
Then through the dave menu, click add new app, you can add the corresponding function, there are rich configuration modules, basically covering the commonly used peripheral functions, I noticed that there is also a motor libray, which integrates the control library of PMSM motors. It is estimated that using a single chip xmc4800 to directly develop ethercat servo drives is also a good solution. At present, many servo drive solutions on the market use a single dsp to control the PMSM motor, and then use a CPU to realize the ethercat slave. This will make the cost much higher. I wonder if Infineon has provided this evaluation plan. It should be very competitive. Also, I hope the price of this single chip xmc4800 is not too expensive. If the price of a single chip exceeds that of two stm32s, it will make people want to say that it is not easy to love you.
I also added the freeRTOS component first. Thinking back to the CPU in the past, I had to port everything myself. Now the ide management is so powerful that the underlying library and the upper operating system can be fully configured with just a few clicks of the mouse. This efficiency improvement is really huge. The efficiency improvement brought by the technology upgrade is really ahead of the times.
I used the default configuration of free rtos, ticker is 1000 times per second, and other stacks are all default configurations. Then click dave menu to generate code
Find DIGITAL_IO_ToggleOutput function, select the function, right click or press F3 to jump to the definition. The official code also integrates basic test usage, just copy it directly to main.
Attach the code: int main(void) { DAVE_STATUS_t status; uint32_t delay_count;; status = DAVE_Init(); /* Initialization of DAVE APPs */ if(status != DAVE_STATUS_SUCCESS) { /* Placeholder for error handler code. The while loop below can be replaced with an user error handler. */ XMC_DEBUG("DAVE APPs initialization failed\n"); while(1U) { } } DIGITAL_IO_ToggleOutput(&LED2); while(1U) { #if 1 DIGITAL_IO_ToggleOutput(&DIGITAL_IO_1); //toggles : 1 -> 0 (if initial output level is logic 1) //Add application code here for(delay_count = 0;delay_count<0xfffff;delay_count++); DIGITAL_IO_ToggleOutput(&DIGITAL_IO_1); //toggles : 0 -> 1 //Add application code here for(delay_count = 0;delay_count<0xfffff;delay_count++); #endif } } Compiled ok, ready to download to hardware, the newly created project needs to configure the debugger, right click on the project name, click debug as, select debug configuration
In the pop-up menu, double click GDB SEGGER J-Link Debugging to generate the debug configuration of the project, the default configuration does not need to be changed.
You can see that the led1 light is flashing. After restarting, it still falsh led. In this step, freeRTOS was added, but it hasn't run yet. It's been many years since I last used freeRTOS.The next step is to get familiar with freeRTOS and schedule two tasks. I have to say that the current development is really advanced. The entry threshold of new hardware and new platforms is getting lower and lower. It allows developers to focus more on development rather than building platforms, and completely get rid of the most tedious register configuration. It's great.