Great video as always.. From the past 5 days I'm literally checking your channel every hour to see if the next video is out or not.. Can't wait for the next video.. I have also ordered a STM32 for upgrading my drone.. :)
Excellent explanation what is going on in the Arduino code !! In my GPS-car, I use the sum-signal with a input capture function. Big advantage : only 1 pin is needed, and the Interrupt timing is not critical anymore because the timer value is stored by hardware. I dont know or this possible with Arduino, I use GCC-compiler.
Regarding the code at @9:20 - those functions are all marked "inline" so, as long as the compiler respects that, they shouldn't generate any overhead compared to directly accessing SYSTICK_BASE->CNT
maybe a stupid question... What about using ibus instead of the pwm? I dont even know what ibus is but im about to inform me because i want to make something similar but with arduino so i only have two external interrupts
Joop, you mention that your goal is to get the YMFC-AL to fly with the STM controller. Sounds great! Just curious why you didn't just go to the faster Arduino Zero or Due? Is it because you're wanting the smaller size of the STM? It looks like the 48MHz Arduino Zero, for example, may run the YMFC-AL code with little to no mods perhaps, yet the STM seems to require a lot.
Think I see the issue. Some of these faster boards aren't truely compatible with the real\original Arduino IDE. It has to do with arduino.cc separating from arduino.org. Aaaarrggg.
Exactly, just like there is _an hour_ not _a hour_ . Even though the words are starting with a consonant alphabet but their pronunciation produces a vowel sound. Similarly when pronouncing _R_ , there is a _Schwa_ sound, phonetic transcription : *_ɑ_* ,which is similar to a vowel sound.
Wow great presentation. Clear and detailed, thank you. For my RC projects I use Input Capture for PPM receiver inputs and Output Compare for PWM servo/motor outputs - this method is not CPU time sensitive and most importantly jitter-free.
Help needed With sketch STM32_ICM-2 I am able to check receiver channels on serial monitor With correct readings. Now if I use YMFC-32_Auto_Test_program_ver_1a This is what appears Waiting for a valid receiver channel_ 0 input signal The input pulse should be between 1000 til 2000 Current channel-3 receiver input value =0 I have tried two different radios and two different receivers. Help will be appreciated. Thank you
QQ: Could you just change the timer interrupt priority to highest to let the time function work correctly ? Instead of checking registers for overflow, seems simpler to me....
I like the way you progress though the problem, it is useful for the viewers to see how to work through these problems... life gets a bit trickier when you bring interrupt servicing into a previously simpler firmware design. I have been playing around with RC pulse (Tx and Rx) for a while now as well (going back to 1998!). If I could comment on that Interrupt Handler, I would highly recommend making the timer/tick interrupt the highest priority; this is the typical way it is done, especially when advancing to more complicated RTOS based firmware. As you have demonstrated, the tick is the literal heartbeat of the system and provides synchronization and timing for all other system, including other interrupts. Once again, thanks for the video. You constantly produce high quality content, well done. - Eddy
I had a problem. I am using a ppm receiver and a mpu6050 but I'M able to read one thing at a time I you needed the code Then I can send you but please Solve that problem. Or make a dedicated video so that everyone can use ppm receiver.
This line is true when the 26 bit of the ICSR register is set. ob1 is just a one & is the operator and SCB_BASE -> ICSR is the reference to the ICSR register >> 26 moves the bits 26 positions to the right
@@timothysimonthomas3396 >> is bitwise operator which shifts one bit right. 0b11110000 >> 1 equals 0b1111000. And thus >> 26, means 26 shifts to the right. Then there is & operator (0b1 & (etc)) , after all execution just ANDs the whole expression if (0b1 & 0b1) then it's true.
Excellent well-paced video, thanks! I'm left wondering whether anyone makes an rc receiver that just outputs digital information over I2C, for example. It seems absurd for it to be converted into the analogue domain (pwm) and back. I know that gives compatability with ordinary servos, but can you get I2C servos?
The PWM principle starts a long way back when the first transmitter/receivers where made. Most "digital" receivers mostly use the S.bus protocol. It's a serial data connection. You can get servo's that use the S.bus protocol.
How can we interface the STM32 or the arduino UNO to read the S.Bus signal? That would make the circuitry a lot simpler when it comes to wiring up the quad, doesn't it?
Good Day Sir! :) We are planning to build a drone using Arduino ATX2, but we do not know how to connect an RC controller to the micro-controller. Would you mind helping us out? You're help is really a big deal! Thank you so much!
Where can I download a bin file for bootloader, to connect Geehy APM32F103CBT6 via USB to Arduino ? The classic file hid_generic_pc13.bin is not compatible.
is it possible to make interrupts only when the signal changes? then you can just have the interrupts toggle a variables, while the main loop uses the variables.
I think one core mcus are not very suitable for parallel tasks. I am getting esp32 family boards to experiment with different hardware. Also there is fast STM32F4 with Cortex-m4 and 168Mhz clock that could be good too. For advanced stuff more specific IDE/soft than Arduino is needed. I am waiting for cheap quad cortex mcu boards
Hi Joop. I have a question regarding your code. The example modifies the variable receiver_input1 from the interrupt handler and displays (reads) it in the main loop. Given the fact that the variable receiver_input1 is 32-bits long, the execution of the function Serial.println() may be suspended in order for the interrupt handler to be executed first which could cause corrupted output of the function Serial.println(). May this be the cause of the spikes? Thank you!
Wow, this video is awesome! Thanks for sharing knowledge with the audience. I am, however curious why that problem of micros() reading being faulty DIDN'T occur at YMFC project series. Also, why is Arduino UNO much faster at finishing external interrupt functions?
Take some free time and reliable internet connection, no need for college. I learned microcontrollers at home when i was just 13, all using just information from internet. Don't be scared by digital, it won't bite you ;-)
Hi, after trying the first examples i'm now on the setup test and by compile the code I get error message YMFC-32_Setup_ver-1a:31:1: error: 'HardWire' does not name a type HardWire HWire(2, I2C_FAST_MODE); Any idea was is going wrong by me Regards
Greetings from Canada Joop, I was fooling around with these STM32 F103 dev boards a couple of years ago and the goal at the time was to mount the Cleanflight FW on it. Designed originally for multirotors , and an offshoot from Baseflight which has its origins in Multiwii. We had no problems running the earlier versions that were almost 128K of code with Baro and 9DOF module, plus a piezo beeper. But I went thru at least three of these dev bds, they would just refuse to go into boot mode. There are two or three versions of these STM32 break out boards out there and I can say that it pays to have a selection/supply to choose from. Reply if you wish the links to RCGroups thread. Best regards
32bit architecture vs 8bit. 10*12bit ADC vs 8*10bit. 20kB SRAM vs 8kB or less. From 64 up to 256kB of FLASH (depends on particular chip) vs from 8 to 128kB. USB and CAN even in lower end chips. 3*UARTs vs 1 or 2. 2*I2C vs 1. 2*SPI vs 1. Build in bootloader trough UART, SPI and STLINK vs SPI/ISP only. 72MHz max rated clock (WO overclocking) vs about 16MHz or so. Battery back up for RAM. Far more advanced interrupts, timers. More hardware PWM.
My understanding is that in the Arduino version of the code with 4 channels the case of all state changes happening simultaneously will generate 4 interrupts each one interrupting each other, and the ISR routine will run 4 times. However the state change for all channels will be handled the first time the ISR routine is run, and the subsequent 3 times through the routine do nothing. A good approach for timing accuracy.So to compare apples with apples, my question is: is the 17uS (272 clock cycles) measured for the Arduino 4 times through its ISR routine or once? I'm hoping :-) the final goal of these new videos is to port YMFC-AL to STM32 leaving enough processing power to add compass, barometer and (perhaps) GPS.
Hi, Sir. I wonder whats the difference between using arduino IDE and using IDE like keil u vision to program stm32f103c8t6. Will arduino take up much more memory?
The Arduino IDE will give you a head start and setup all the base settings to get the board to run. This will consume some memory but not much. With Keil you might need to setup the microcontroller by hand. This means a very steep learning curve.
@@Joop_Brokking Once you learn it you can do inline debugging which is a breath of fresh air. I'm going to start by using NUCLEO-F103RB board and Keil. Hopfully I will start have hair left afterwards.
Great video! Maybe stupid; would it not be faster to handle 1 channel only as RISING interrupt (as they occur at the same time), and then only handle FALLING interrupts separately? That would probable almost half the total time spent on interrupts?
That's only true for the _Futaba_ receiver. (Timecode 13:34) The _Fly Sky_ receiver staggers the start pulses. (Timecode 13:18) I don't think you want your code to only work with certain brands of receivers. By the way, maybe _Fly Sky_ staggered the start of the pulses to make the code reading them to not cause all those interrupts at the same time. On the other hand, the end of the pulses could get synchronized at random times and still have the same problem. It would be a very rare occurrence, the hardest kind of issue to discover during testing.
The I2C hardware needs the highest priority. So it's not possible to set the systick to the highest priority without problems. That's one of the downsides of the STM32. On the other hand the systick interrupt keeps pending so it stays accurate and only differs a few nanoseconds.
The S.Bus is just an inverted 100kbps UART signal. You don't need an library for that. But not everybody has a S.Bus output. So to keep it useful for everybody I will use normal PWM.
It hurts a little to see how the STM32 is limited so much by trying to make it "arduino like". The STM32 hardware is so much more capable (not just in speed and memory but general functions) than the AVR. Using timer input capture will make this problem much easier (or at least easier to make glitch free while being efficient).
The STM32 for Arduino indeed limits the functionality of the STM32 with the core files. Luckily it's possible to use direct register access. This way it's still possible to use almost every function of the STM32.
I really appreciate how clearly you are describing your code and the issues. Your diagrams are very clear and helpful. I hope you will work on the core files and then submit a patch. That way you fix the problem for everyone, not just your projects. At the very least there could be a DEFINE that specifies which processor the code is intended for so that conditional compilation can add features for those processors that have them.
Sorry for the delay missed Your comment github.com/gatis-ozols/ppm_stick Beware that that is CubeMX generated code (meant for STM32 System Workbench IDE), it is NOT Arduino IDE compatible.
This is described in the previous video of the series: "Getting started with the STM32 microcontroller - STM32F103C8T6 via Arduino" I recommand you view it before this one (as it is told by Joop in this video).
@@Loopyengineeringco I think that doesn't always work. Different PC's running different versions of windows won't always detect the USB device correctly. It has something to do with the wrong resistor value pulling up one of the USB lines. It violates some plug and play specification, so some computers have trouble with it. I prefer using STLink device to program the STM32. They are very cheap and allow the ability to free up all flash (no bootloader) and hardware debugging using GDB.