How To Write A Driver (Audio CODEC & I2C) - Phil's Lab

Поділитися
Вставка
  • Опубліковано 22 лис 2024

КОМЕНТАРІ • 59

  • @dazai7669
    @dazai7669 3 місяці тому +19

    Wake up babe, new Phil's lab video.
    Perfect timing! I just bought a stm32f4 discovery board to start my audio dsp journey. Thank you for uploading these videos!

    • @PhilsLab
      @PhilsLab  3 місяці тому

      Awesome, hope all goes well with your new board!

  • @guitarbass95
    @guitarbass95 3 місяці тому +1

    I was literally just hitting a crossroads where existing libraries weren't useful and I find you uploaded this at a perfect time

    • @PhilsLab
      @PhilsLab  3 місяці тому

      Awesome, hope this helps!

  • @AntonioBarba_TheKaneB
    @AntonioBarba_TheKaneB 3 місяці тому +6

    you don’t need to convert all those binary values to hex manually, just enter them directly as 0b10101010 and let the compiler do the conversion.

  • @perceptron9834
    @perceptron9834 3 місяці тому +2

    Just finished the bme280 i2c driver for the ble-pill 😊. Fits good to the topic

  • @leifefrancisco7316
    @leifefrancisco7316 3 місяці тому

    Just as I'm building the same thing using the 4272 you come to save the day!

  • @eleclab4244
    @eleclab4244 3 місяці тому +2

    Amazing video, as always!
    I wonder if you can make a video about class-d amplifiers, some basic PCB layout guidelines related to the topic, as there is almost nothing on UA-cam for years explaining "scientifically" how to do it the right way! A good example would be an IRS-based amplifier.. cheap .. and simple!
    Thank you for your content!

    • @PhilsLab
      @PhilsLab  3 місяці тому +2

      Thank you! I have a basic Class-D amplifier design on the channel, but nothing terribly in-depth. Something I'd definitely like to make some more content on though!

  • @phill__6239
    @phill__6239 3 місяці тому +7

    top 5 technical design EE channels on youtube

    • @PhilsLab
      @PhilsLab  3 місяці тому +1

      Thank you very much!

    • @karama300video
      @karama300video 3 місяці тому +2

      Hey, can you tell me the other 4?

    • @bobby9568
      @bobby9568 3 місяці тому

      what are the other 4?

    • @hoangvanthanh2201
      @hoangvanthanh2201 3 місяці тому

      what are the other 4?

    • @zero7523
      @zero7523 3 місяці тому

      What are the other 4?

  • @SergiuszRoszczyk
    @SergiuszRoszczyk 3 місяці тому +1

    I’m not sure about just plain write 0 to reserved bits. Back in the old times of AVR, before Arduino even existed I was always reading register and only altering bits I need. It takes a bit of extra effort but in (quite likely in a longer term product) the event of swapping CODEC for something pin compatible (ie due to lack of parts) it may save you a day if a manufacturer just added new features in those bits

    • @PhilsLab
      @PhilsLab  3 місяці тому +1

      Agreed - and as was alluded to in the video, although in not terribly much detail. Additionally, the driver here in the video is meant to be incredibly basic (for simplicity and time constraints of the video). Thus, I linked to the 'extensive' CODEC driver in the Linux Git repo, for a more thorough implementation after having covered the essentials.

  • @TomLeg
    @TomLeg Місяць тому

    I wish you designed things using components which were not discontinued. There are still some at Mouser, and of course there will be some supplies out there.

  • @kiprof4350
    @kiprof4350 3 місяці тому +1

    Thank you so much for this video, Phil! It is an amazing video! and I am eagerly awaiting your next outstanding Zynq videos. 🙂

    • @PhilsLab
      @PhilsLab  3 місяці тому +1

      Many thanks - planning on making more Zynq videos as well!

  • @rafaelbertacchi
    @rafaelbertacchi 3 місяці тому

    It would be great if you make a video about the analog parts that come before and after the codec... What filters and buffers to use, impedances. Differences between instrument, mic, phone and line signals. How to deal with Balanced and unbalanced inputs and outputs... That kind of stuff 😉

    • @PhilsLab
      @PhilsLab  3 місяці тому +1

      Definitely some topics to come in future videos!

  • @AmmarH413
    @AmmarH413 3 місяці тому

    unbelievably great

  • @Kmnri
    @Kmnri 3 місяці тому

    Nice video, will you make a tutorial similar but without using their HAL? I would love to get into H7 series but stm32 hal is big nono

  • @crosswick
    @crosswick 3 місяці тому

    You're amazing Phil. Thanks again

    • @PhilsLab
      @PhilsLab  3 місяці тому

      Thank you!

    • @crosswick
      @crosswick 3 місяці тому

      @@PhilsLab I think part of what makes this format so great is the speech pause editing. I wonder how far you've automated that :)

  • @Tonikiller10000
    @Tonikiller10000 3 місяці тому

    I like all your videos!!! You make some real stuff content.
    I have 3 questions:
    - for the SPI drivers, where the IC has I2C and SPI comunication (EX: BMA400 accelerometer) the register addresses are the same ast the I2C ones? Otherwise, can you make a video where you connect a device with SPI to the STM32 and make a driver for it?
    - can you make a video about the SPI or I2C HAL drivers? I am curious to make my own HAL comunication drivers thinking that is like in the arduino ide where is much faster to write dirrectly on a register than to use digitalWrite, where it checks various things, like if the port is on OUTPUT mode and so on.
    - can you make a video about stm32 flash memory? ...basic writing, reading and constrains. I am writing some lora code on the STM32 and one nonce variable is stored in the flash, but is reseted somehow at reset with the same random value. I think somehow it is stored inside the first FLASH addresses with the code, and the code somehow is written on that address. Anyway, I saved the variable again at the end of the flash memory, and seeing it on the ide memory browser, it is saved correctly. This variable is has to be incremented at each join request, and if I restart the STM32 it starts back to 0 and it can`t connect again with the values already used.

  • @Tron56850
    @Tron56850 3 місяці тому

    Great video! Maybe an obvious question but what's the order in which you implement your driver, before or after designing your custom PCB ?

    • @PhilsLab
      @PhilsLab  3 місяці тому +1

      Thank you! I reference the datasheet several times during part selection, schematic, and PCB design. Also in relation to the software implementation to see if there are any 'gotchas' (such as specific pin settings, modes, etc.). The actual driver implementation I only really start after I receive the boards.

  • @cjb89
    @cjb89 3 місяці тому +1

    Great video, as always! But when you define the CS4270_REG_CONFIG_SETTINGS, why do you write them in hex? Can't you just write 0b00110001 for the mode, for example?

    • @PhilsLab
      @PhilsLab  3 місяці тому +1

      Thanks! Yep, you can do that - just an (odd) habit of mine.

    • @cjb89
      @cjb89 3 місяці тому +1

      @@PhilsLab I just did a bit of research and it seems that the 0b... is technically not in the C standard, but most compilers still support it since it's relatively common. So I guess converting to hex is not a bad habit and I've been living dangerously, haha 😎

    • @PhilsLab
      @PhilsLab  3 місяці тому

      Ah that's good to know, thank you!

  • @casualnoises2808
    @casualnoises2808 23 дні тому

    The CS4270 seems to be deprecated and can be replaced with the newer CS4272.

  • @awocrf
    @awocrf 3 місяці тому +1

    Hi! I have an unrelated question. I'm making a project where i need to supply a few different voltages to my circuit (Let's simplify that to 3,3V, 2,8V and 2,0V). My power source is 2S Li-Ion battery pack. I want to use a switching regulator because battery life is important in this but i'm concerned about noise since some of the circuitly would be analog. Would it make sense to combine a switching regulator that would step down the voltage from 6-8,4V to about 3,6V and then use a linear regulators to make all the different voltages from that?

    • @catalinm756
      @catalinm756 3 місяці тому

      Yes. Use switchers for digital and ldos for analog and noise sensitive circuits

    • @awocrf
      @awocrf 3 місяці тому

      @@catalinm756 I was talking about a different approach but this solution would be fine too.
      I meant something like this:
      Li-Ion -> switching reg. -> LDOs -> everything else
      where Li-Ion outputs 6-8,4V, switching reg. 3,6V and LDOs 3V3, 2V8 and 2V0. In this case a switching regulator doesn't power anything directly, only through linear regulators. I've seen this approach in some high power lab power supply to combine high efficency of switching regulators and low noise of linear regulators.
      In your approach what would be better: connecting everything to the same ground or having 2 grounds connected in a single point somewhere?

    • @tariqsingh3747
      @tariqsingh3747 3 місяці тому

      @@awocrf Use one ground. Make sure that you have good PSRR at the switching frequency, and you'll be all good unless you need some ultra-low-noise power.

  • @felmtony1277
    @felmtony1277 2 місяці тому

    Nice

  • @ameenibrahim7519
    @ameenibrahim7519 3 місяці тому

    Sir I have project it is for straightness measurements by psd laser sensor, can you please help me designing the PCB layout?? Also I have the major electronic parts needed like analog multiplayer and amplifier but I have an issues for making the power circuit, I am a mechanical engineer not electrical.

  • @bobby9568
    @bobby9568 3 місяці тому

    Phil took the blue pill #Matrix

  • @RiwenX
    @RiwenX 3 місяці тому

    Hey Phil, as an embedded developer, what's your take on Rust?

    • @PhilsLab
      @PhilsLab  3 місяці тому +2

      Never used or explored it (or seen a reason to), so can't really comment I'm afraid.

    • @projectsspecial9224
      @projectsspecial9224 2 місяці тому

      Over the years, I have done numerous embedded projects using only ANSI C, C++, Assembly, and Python. Never had the need to use Rust. I'm sure there are probably good use cases that it can benefit from. But for me, I never had to use Rust professionally or required to.

  • @tamaseduard5145
    @tamaseduard5145 3 місяці тому +1

    👍🙏❤️

  • @nonfortuneuser
    @nonfortuneuser 3 місяці тому

    ❤❤♥

  • @samuelemmettbray
    @samuelemmettbray 3 місяці тому +3

    Phil. We don't use C, anymore.

    • @PhilsLab
      @PhilsLab  3 місяці тому +5

      😅

    • @bobby9568
      @bobby9568 3 місяці тому +2

      xD

    • @rajimordecai1099
      @rajimordecai1099 3 місяці тому +2

      C still remains the bedrock for embedded programming

    • @abo1428
      @abo1428 3 місяці тому +2

      fukumean „we don‘t use C, anymore“?

    • @scottfoulk7480
      @scottfoulk7480 3 місяці тому +1

      C is it.