Тёмный

STM32 for Arduino - Connecting an RC receiver should be easy, right? 

Joop Brokking
Подписаться 79 тыс.
Просмотров 132 тыс.
50% 1

Опубликовано:

 

28 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 121   
@dtpc_technologies
@dtpc_technologies 7 лет назад
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.. :)
@Joop_Brokking
@Joop_Brokking 7 лет назад
Please don't hold your breath for it. Making a video is very time consuming. It might even take two weeks or more :-(
@dtpc_technologies
@dtpc_technologies 7 лет назад
Joop Brokking No problem sir.. Keep up your great work.. You are my motivation.. 👍👍
@RP6conrad
@RP6conrad 7 лет назад
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.
@sidaqbarw918
@sidaqbarw918 2 года назад
Thank you very much but I have a problem error: 'Timer2' was not declared in this scope how do I solve this problem
@MrEdwardhartmann
@MrEdwardhartmann 7 лет назад
Great video. I can't wait to see how you optimize this code.
@GrahamStw
@GrahamStw 7 лет назад
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
@MrLimetto
@MrLimetto 7 лет назад
That's what I call a great explanation. Keep up the nice animation / graphics! ;)
@trarredbandit9734
@trarredbandit9734 2 года назад
Is it possible to do this with the esp32?
@sergiourquijo4000
@sergiourquijo4000 4 года назад
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
@donkelly36
@donkelly36 7 лет назад
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.
@donkelly36
@donkelly36 7 лет назад
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.
@Joop_Brokking
@Joop_Brokking 7 лет назад
I have now specific reason for the STM32. I just like to explore new microcontrollers and the STM32 is really cheap and easy to obtain.
@berndeckenfels
@berndeckenfels 5 лет назад
Could you only trigger one channel for the raising flank and only have the interrupts for each channel on the falling trigger?
@omhobby9481
@omhobby9481 4 года назад
please make tutorial with frsky SBUS
@birendrakumar-gl5gq
@birendrakumar-gl5gq 5 лет назад
I have a question if i want to use 10 channel flysky transmitter and receiver,do i need to chande the code?
@Eren-to7nx
@Eren-to7nx 6 месяцев назад
Hello, did you find the answer to this question?
@omhobby9481
@omhobby9481 5 лет назад
My brain is smoking...but its very interesting
@AndrewR2130
@AndrewR2130 5 лет назад
Would it be possible to toggle a piece of code by reading output from rc reciver example coustom lights and flash patterns toggled via remote
@RakshithPrakash
@RakshithPrakash 4 года назад
This is what I'm trying to achieve
@RakshithPrakash
@RakshithPrakash 4 года назад
I did it
@toddspeck9415
@toddspeck9415 7 лет назад
Awesome!
@TanishqIsHere
@TanishqIsHere 7 лет назад
Joop, in your title there is a tiny grammatical error, use 'an' instead of 'a' before 'RC'
@Joop_Brokking
@Joop_Brokking 7 лет назад
Thanks for the tip. I thought that 'an' should only be used with a vowel sound. And 'a' with a consonant sound. Please elaborate.... I'm Dutch ;-)
@TanishqIsHere
@TanishqIsHere 7 лет назад
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.
@Joop_Brokking
@Joop_Brokking 7 лет назад
Thank you for the explanation! I will change the title :-)
@Tech2C
@Tech2C 7 лет назад
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.
@MrRonychakraborty
@MrRonychakraborty 7 лет назад
You are the boss :) carry on. Thanks for working on Stm32
@crescenciolara2279
@crescenciolara2279 5 лет назад
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
@araferw9479
@araferw9479 5 лет назад
i have the same question
@silnangmarak
@silnangmarak 2 года назад
can you use s-bus instead of using each channel to connect to stm?
@zhivebelarus560
@zhivebelarus560 3 года назад
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....
@EngineeringVignettes
@EngineeringVignettes 7 лет назад
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
@SKElectronics
@SKElectronics 7 лет назад
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.
@zeshan2973
@zeshan2973 6 лет назад
11:58 can anybody please explain this line.... if (ob1 & SCB_BASE -> ICSR >> 26) ?
@Joop_Brokking
@Joop_Brokking 6 лет назад
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
@timothysimonthomas3396 3 года назад
@@Joop_Brokking could you please elaborate a bit more please, or suggest relevant material?
@waplet
@waplet 3 года назад
@@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.
@raykent3211
@raykent3211 6 лет назад
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?
@Joop_Brokking
@Joop_Brokking 6 лет назад
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.
@sriharivishnubhatla
@sriharivishnubhatla 6 лет назад
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?
@christianolivergalopo1189
@christianolivergalopo1189 7 лет назад
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!
@VasyVasii
@VasyVasii 14 дней назад
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.
@adityapachore366
@adityapachore366 5 месяцев назад
Sir, the Example code links are not working!
@adityapachore366
@adityapachore366 5 месяцев назад
Update the description box
@garyprice3757
@garyprice3757 7 лет назад
Got the same scope. Encoders are rubbish but apart from that, a fairly reasonable device.
@hendmei7066
@hendmei7066 2 года назад
hello, can you do it for the aircraft and specifically for the FSi A6B receiver!?
@judgeomega
@judgeomega 3 года назад
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.
@browaruspierogus2182
@browaruspierogus2182 6 лет назад
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
@adelashour3253
@adelashour3253 4 года назад
Was there such problem in arduino uno? That didnt appeared in ymfc al
@alk2345
@alk2345 5 лет назад
Thank you that you explain this interesting things distinctly and not fast =) p.s. eng is not my lang =)
@aminezitouni8427
@aminezitouni8427 6 лет назад
Joop you must please notice, in 5:46 "every 4 ms instead of every 4μs"
@tigransargsyan5835
@tigransargsyan5835 7 лет назад
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!
@Joop_Brokking
@Joop_Brokking 7 лет назад
The spikes are exactly 1ms long and are the result of the timer not updated due to the interrupt override.
@Life-ze1no
@Life-ze1no 7 лет назад
good videos...keep it going~!!! cheer
@mrtmrf5007
@mrtmrf5007 7 лет назад
Very good and easy tutorial ..keep the good work... thanks
@roycas3
@roycas3 5 лет назад
Can you please do a video for stm32 + NRF24 transceiver. ?
@junuhunuproductions
@junuhunuproductions 7 лет назад
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?
@PhG1961
@PhG1961 7 лет назад
Waw Joop, zeer goede video !
@davebenemerito310
@davebenemerito310 6 лет назад
I am thinking what college degree I'm going to learn things just like this one and microcontrollers.. what would be the best fit?
@Joop_Brokking
@Joop_Brokking 6 лет назад
I learned everything I know at home :-) I'm a high voltage engineer by trade.
@davebenemerito310
@davebenemerito310 6 лет назад
Good to know, thanks for the reply :)
@alaksmcgregor3358
@alaksmcgregor3358 6 лет назад
Try electrical engineering.
@davebenemerito310
@davebenemerito310 6 лет назад
Would computer engineering be relevant?
@macieksoft
@macieksoft 5 лет назад
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 ;-)
@vitaliyd193
@vitaliyd193 7 лет назад
thanks! I messed my arduino to read these 60 month ago, and gave up. Cant wait for next video !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@john92648
@john92648 4 года назад
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
@brettmcgrath4363
@brettmcgrath4363 2 года назад
Have you got an answer to the problem
@KhiemNguyen-oo9yp
@KhiemNguyen-oo9yp Год назад
Change the Hardwire to TwoWire
@chrisleech1565
@chrisleech1565 7 лет назад
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
@sumit_kashyap..
@sumit_kashyap.. 7 лет назад
What is different between 3 axis and 6 axis gyro ???
@Joop_Brokking
@Joop_Brokking 7 лет назад
There is no 6-axis gyro. What you mean is 6 degrees of freedom. This is 3 gyro axis + 3 accelerometer axis.
@rich1051414
@rich1051414 5 лет назад
Can someone explain how the STM32 is better than the various ATMega chips? It seems more difficult to work with.
@signalworks
@signalworks 5 лет назад
And to summarize: Much, much faster, a lot cheaper, many more interrupts and better PWM as well as better ADC.
@macieksoft
@macieksoft 5 лет назад
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.
@walidhanniche5545
@walidhanniche5545 5 лет назад
Daft punk already did Harder better faster stronger
@siarheibartashevich2287
@siarheibartashevich2287 4 года назад
What about Jittering?
@andybarnard4575
@andybarnard4575 7 лет назад
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.
@Joop_Brokking
@Joop_Brokking 7 лет назад
The Arduino is measured with 4 channels all have a rising edge at the same time.
@JoaoNelsonLima
@JoaoNelsonLima 6 лет назад
enable captions
@davide5137
@davide5137 7 лет назад
Why not using arm mbed language? However great work joop, thisi is amazing!!
@Joop_Brokking
@Joop_Brokking 7 лет назад
Because the STM32 for Arduino add-on has it's own specific functions. But working with registers will work on all platforms and IDE's.
@davide5137
@davide5137 7 лет назад
and apart from the registers code, do you think mbed language could be faster than arduino language on an mbed enabled stm32 board?
@PeterK6502
@PeterK6502 7 лет назад
Hoi, Ik heb ook effe een scoop op mijn futuba receiver (R617FS) gehangen, het pulse gedrag is gelijk aan wat je bij de fly sky receiver hebt getoond.
@Loopyengineeringco
@Loopyengineeringco 7 лет назад
Fantastic explanation. Thank you!
@fpvrcstuff
@fpvrcstuff 7 лет назад
You Sir, are a genius ! Great video!
@Kongfufrank
@Kongfufrank 4 года назад
Ide arduino não funciona? Falta arquivos? Ensina instalar stm32 em aduino ide?
@ervinsalazar9026
@ervinsalazar9026 5 лет назад
HI can you please help me configure systick interrupt on arduino ide so i can trigger a code at 1Khz, please i need your help
@HAMZAHAHMED
@HAMZAHAHMED 7 лет назад
great #
@noamkoren1839
@noamkoren1839 7 лет назад
Hey Joop great work!! I was wandering where do you find the info about using direct pin manipulations for STM32f1?
@Joop_Brokking
@Joop_Brokking 7 лет назад
In the datasheet and in the STM32 for Arduino core files.
@gacherumburu9958
@gacherumburu9958 6 лет назад
🤔🤔
@stevenlee1726
@stevenlee1726 7 лет назад
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?
@Joop_Brokking
@Joop_Brokking 7 лет назад
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.
@pow9606
@pow9606 4 года назад
@@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.
@MarcelOoms
@MarcelOoms 7 лет назад
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?
@RobertShaverOfAustin
@RobertShaverOfAustin 7 лет назад
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.
@MarcelOoms
@MarcelOoms 7 лет назад
O, clear.
@rodstartube
@rodstartube 7 лет назад
as always, superb!
@cue108
@cue108 7 лет назад
you are awesome!
@minseokkim6144
@minseokkim6144 7 лет назад
Awesome
@tcurdt
@tcurdt 6 лет назад
It's odd that the system timer does not use the highest priority. Is there no (easy) way to change that?
@Joop_Brokking
@Joop_Brokking 6 лет назад
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.
@noijze
@noijze 7 лет назад
aren't there S-bus libraries available for arduino or so
@Joop_Brokking
@Joop_Brokking 7 лет назад
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.
@superdau
@superdau 7 лет назад
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).
@Joop_Brokking
@Joop_Brokking 7 лет назад
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.
@gatisozols
@gatisozols 7 лет назад
I totaly agree about timer capture. I have made an STM32 HID joystick with ppm receiver, the PPM decoding took about 10 lines of code.
@dexop
@dexop 7 лет назад
Gatis Ozols could you share your code?
@RobertShaverOfAustin
@RobertShaverOfAustin 7 лет назад
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.
@gatisozols
@gatisozols 7 лет назад
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.
@plazmax
@plazmax 7 лет назад
Is it not programed via usb port ? Need ftdi?
@SKElectronics
@SKElectronics 7 лет назад
plazma Yes it needed ftdi or stlink.
@JeanLucCoulon
@JeanLucCoulon 7 лет назад
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
@Loopyengineeringco 7 лет назад
You can program it via USB if you flash a different bootloader to it, i recommend doing it! github.com/rogerclarkmelbourne/STM32duino-bootloader
@sodichz
@sodichz 6 лет назад
Many thanks for your effort. Kindly note that I did your YMFC Al. the. I tried to make the 32 one , but I faced same issue which you explained here.
@mikebrown7366
@mikebrown7366 5 лет назад
@@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.
@sukhee5
@sukhee5 6 лет назад
Where did you bought FDTI. I need model number FDTI.
@wouter11234
@wouter11234 7 лет назад
Isn't it an RC and not a RC?
Далее
ТАРАКАН
00:38
Просмотров 531 тыс.
Катаю тележки  🛒
08:48
Просмотров 445 тыс.
“Hello, world” from scratch on a 6502 - Part 1
27:25
Converting devices to USB Type-C
16:25
Просмотров 7 млн
Why build an entire computer on breadboards?
28:43
Просмотров 3,1 млн
Reading PWM Receiver Signal Using Arduino
15:34
Просмотров 68 тыс.
How to use an RC Transmitter with Arduino (Lesson #18)
13:43