Control stepper motors with app cpu (cpu1) and maintain web server on pro cpu (cpu0)

andynodi
Posts: 2
Joined: Mon Oct 30, 2017 8:28 am

Control stepper motors with app cpu (cpu1) and maintain web server on pro cpu (cpu0)

Postby andynodi » Mon Oct 30, 2017 8:40 am

Hello,

I need to control stepper motors (10khz) using web interface. If you know a good solution (multi core preferred) than just ignore this message and refer to the example. Else these were my "experiments:

i try now almost since more than one week to figure out, how i can generate a certain number of ticks (about 10khz) on a gpio without getting distorted by a web server: actually libwebsocket : https://github.com/warmcat/libwebsockets.

what did i tried:

Solution 1 : generate a simple hw timer interrupt and switch gpio manually: If i access webserver on cpu0, interrupt doesnt work. Maybe webserver (libwebsocket) access on cpu1 and disables interrupt or due to spi usage (memory access) anything is prohibited. But my timer isr is marked with IRAM_ATTR and i use only xtensa commands.

above should be the standard solution but i also tried
Solution 2: CONFIG_FREERTOS_UNICORE: set on TRUE and programm my own start_cpu1 using interrupt: Memory management is too compilicated that i cannot create timer_isr successfully: I hope you will provide a cpu0=freertos cpu1=nothing version.

Solution 3: I wanted than do everything manually using get tick count(ccount) . I have diff'ed tick counts to get a constant period for gpio but i can hear from the sound of stepper motor that even adding a single line, changes the frequency of the output and i dont know why

I would prefer Solution 1 and change nothing on idf but it doesnt work.

I want to replace arduino with esp32 because esp32 can actually everything i need but such a simple task is difficult with freertos

Thanks for your help in advance
Last edited by andynodi on Tue Oct 31, 2017 1:28 am, edited 1 time in total.

andynodi
Posts: 2
Joined: Mon Oct 30, 2017 8:28 am

Re: Control stepper motors with app cpu (cpu1) and maintain web server on pro cpu (cpu0)

Postby andynodi » Mon Oct 30, 2017 12:20 pm

i also tried to use i2s , no success,

now i actually solved the problem using RMT. But http server get very often instable. It must be possible to totally separate the interrupts of cpu's.

Who is online

Users browsing this forum: forrest and 77 guests