Тёмный

Raspberry Pi Pico Lecture 3: Timers, timer interrupts, SPI 

V. Hunter Adams
Подписаться 4,8 тыс.
Просмотров 18 тыс.
50% 1

0:00 - Administrivia
1:15 - Review and lecture goals
4:40 - How to use technical documentation
6:50 - What the example does
8:25 - Includes
11:15 - Macros for parameter values, and declaring some variables
15:15 - Associating GPIO’s with internal SPI signals
18:05 - Initializing stdio
19:15 - Initializing and formatting the SPI channel
23:50 - Brief explanation of SPI communication, with DAC as case study
32:50 - Configuring GPIO functions
34:50 - The 64 bit Timer
39:20 - Timer Alarm registers and interrupts
40:50 - Other timing resources on the RP2040
42:30 - Hardware interface library for the timer
44:01 - Higher level pico_time library and repeating timer interrupts
45:10 - Alarm pools
47:30 - Repeating timers
48:05 - Reiterating timer levels of abstraction
49:50 - Creating a repeating timer in code
Fall, 2022 lectures from ECE 4760 (Digital Systems Design Using Microcontroller) at Cornell University.
Course site: ece4760.github.io
Hunter’s site: vanhunteradams.com

Наука

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

 

6 авг 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 18   
@44mod
@44mod Год назад
Adam I want to thank you for these videos. Watching them and learning from them makes me feel alive and excited. I do not have an electronic background, I worked in construction most all my life. My first computer I bought in 1990, I took it home opened the box and completely disassembled the hole thing in my living room floor. My wife walked in and said to me, what did you do? I did not receive any answers to my question at all that day because I could not see what was going on inside. I did not know how to get to where I wanted to go. In watching you class teaching, I am learning how to get inside. The tools needed to get to where I wanted to go. How to use the tools through the data sheets and how to use those sheets. It is so exciting I just can not weight to break each video down word by word to not miss anything that you say. My eyes can not see as good as they used to and I try to see what you are pointing to on the screen to the right of the video. I wish I could afford to take one of your classes but I cannot. I have the Pico controllers but is their any documentation the kids in the class are reading from in the class, maybe I could buy that and learn even more. I only hope and yes pray that these kids understand the greatness of what you are teaching them. You are not feeding them you are teaching them how to fish and my friend that will feed them forever. I pray that God will bless you in everything that you do! You are blessing me every time I watch one of your videos, and I thank you for that my friend. I am 59 years old and love electronics. I am disabled now and suffer from dementia, but I keep trying to make my mind work hard because I am afraid of loosing what little I have left. I apologize for my comment being so long and I understand you are buzzy and no reply is needed. Thank you and God Bless!!
@ExtantFrodo2
@ExtantFrodo2 Год назад
So you got to see where the magic blue smoke comes from?
@44mod
@44mod Год назад
@@ExtantFrodo2 I actually put it back together and It worked fine. I then started building my own computers. I have seen the magic blue smoke on other occasions and It hurts your feelings.
@ExtantFrodo2
@ExtantFrodo2 Год назад
@@44mod I'm not hurt. I sympathise completely. My own background is not dissimilar to yours except probably a lot more blue smoke in my case. I've never heard of demarche. What is it?
@44mod
@44mod Год назад
@@ExtantFrodo2 Dementia. Sorry I corrected the mistake.
@ExtantFrodo2
@ExtantFrodo2 8 месяцев назад
@@44mod How are you pico studies coming along? I've sort of hit a road block trying to set up the 2 pico debugging system. In Hunters video descriptions he provides links to his course work and they sport all manner of reference documents both on Pi and his specific courses. I hope that helps.
@thatskyfox
@thatskyfox Год назад
Few notes that might be helpful for somebody trying to follow it at home: 1. add_repeating_timer_us might freeze on -25 on some Pico-like boards. Had to reduce to -50 (20 khz). 2. Using R-2R ladder with 8-bit shift register instead of DAC can work with SPI, but Pico only does MSB order. So need reversing bit order before sending, or connecting to shift register accordingly.
@MikeontheMandolin
@MikeontheMandolin Год назад
Loving these videos!
@LeViir
@LeViir Год назад
Hi these videos are amazing and thankyou so mucho for the knowledge. I was wondering if there is a problem with add_repeating_timer_us because setting to 25us it seems to do nothing. I am trying to set a sampling frequency in order to work with a DDS as your examples, but oscilloscope do not show anything(it dos not show the square wave expected at 25us using the mentioned function).
@TooSlowTube
@TooSlowTube Год назад
Bruce's answer at the end was mangled. If the routine doesn't complete in time, does the stack overflow, due to calling the callback again before it returns, or does the SDK library function handle that? Does the repeating alarm callback allow for the time it takes to reset the alarm, or does the timing only give roughly 40kHz? If it sets it to go off again in 25us, but it's taken a few dozen clock cycles to get to that point since the timer last went off, I'd expect it to run slightly slow.
@hunteradams9430
@hunteradams9430 Год назад
The repeating timer callback function is called from an interrupt handler as soon as possible after the time specified. You’re correct that there will be some delay between the low-level timer interrupt firing, and entering the callback function itself. However, The SDK allows for you to specify the delay time as either a positive or negative number. If positive, then this number represents the delay between one callback ending and the next starting (i.e. the ALARM register is reconfigured at the end of the callback). In that configuration, the callback would indeed run more slowly than 40kHz. If that argument is set to a negative number, it represents the time between the starts of subsequent callbacks (i.e. the ALARM register is reconfigured in the timer interrupt). As such, there’s better regularity. If your callback takes too long, it will freeze the CPU (tries to take an interrupt from within an interrupt).
@TooSlowTube
@TooSlowTube Год назад
@@hunteradams9430 Thanks. I was thinking in terms of clock cycles, and how it's not deterministic how long things take, but I guess in this case the timer keeps running and it just sets a new time to do the next callback, so it only has to be done within the same microsecond to keep proper time.
@padcom
@padcom 9 месяцев назад
I thought the timer counts down - hence you need to write the countdown value into the registry and why putting in a 0 disables a timer...
@stefanhennig
@stefanhennig 4 месяца назад
14:08 : shouldn't t line 53 read something like DAC_data = (DAC_config_chan_A | ((sin_table[ phase_accum_main>>24] + 2048 ) & 0x0FFF)) ?
@prozacsf84
@prozacsf84 Год назад
is/are there any python guide/lections ?
@Mr_ToR
@Mr_ToR 9 месяцев назад
30:13 DAC info
@taipo101
@taipo101 6 месяцев назад
he starts to mumble on hardware interfacing? Learning on 8 bit systems where all the interface hardware needs to be developped would be more useful to these students than using a modern include everty thing device. Data sheets need to be understood more between different chip manufacturers. etc.
Далее
Turning a Raspberry Pi Pico into a GPU!
16:42
Просмотров 105 тыс.
Иран и Израиль. Вот и всё
19:43
Просмотров 1,5 млн
The lightweights ended Round One with a BANG 💪
00:10
I Built 3 SECRET Rooms In School!
33:34
Просмотров 13 млн
Raspberry Pi Pico - PIO explained
50:01
Просмотров 27 тыс.
Raspberry Pi Pico Lecture 7: ADC and DMA
49:59
Просмотров 9 тыс.
Pico - USB (host) in and (device) out
10:29
Просмотров 16 тыс.
How to use Timers on the RPi PICO
17:05
Просмотров 15 тыс.
What is PIO | Programmable I/O on Raspberry Pi Pico
5:34