32

Debugging SPI using LEDs...

This is just the worst

Comments
  • 0
    @jespersh switching the lines on and off manually to try and find out what's wrong
  • 2
    You need to buy a logic analyzer
  • 0
    @jespersh I like mosi and miso more :)
  • 1
    Maaaaaaaaaaan
    I have been there too... :'(
    don't suffer this way (unless you like it)

    first: buy a logic analyzer.
    and second: download atmel studio and use its debugger. (runs only on windows :'( )

    ok, I have to tell that atmel studio does not like the fact that you are using arduino libraries...
  • 2
    @mngr I bought one of those cheap knockoff usb logic analyzers, works wonders.

    Also, I'm not using arduino libraries, I have to do "bare metal" so I'm using our school's compiler and the hwlib from my teachers (unfortunately)
  • 0
    @FMashiro
    well, poop.

    is this compiler really different from a common one?
  • 1
    @mngr I have no experience with other compilers or libraries, if you want, you can take a look, since it's open source :P
    https://github.com/wovo/hwlib - lib
    https://github.com/wovo/bmptk - compiler
  • 1
    And now... Let me says it:
    "it is all in the datasheet"
    took me months to understand that...

    no need to reverse engeneer pinout, better read the right paragraph of the right chapter of a endless datasheet

    spi master is easyer to reverse engineer, to do it in spi slave you have first to get CS and clock right ;)
  • 0
    @mngr if only there was a datasheet for my version, I have 1.0 slave and I only found datasheet for 0.9 (things changed unfortunately) and the SD standards are absolute garbage xD
  • 1
    @FMashiro
    Why did people write this?
    is it really necessary to write c++ at hardware level?

    let me explain: in some magic line of code, lost and hidden in the library you are using, there is something that can be resumed like this
    *magic_address = magic_value;
    every peripheral in your mcu has some dedicated memory addresses, writing things in these addresses let you interact with the peripheral, like an API.

    these interactions are described in the datasheet.
    the experience tells me that using library funcion and cabling random things to understand what the hell is doing is way too frustrating.

    why did they make a new library? :'( arduino ide already supports c++ (I think)
    atmel studio do support it for sure... And has a debugger! (yes, debugger for bare metal, compiled programs )
  • 1
    @FMashiro
    I meant the atmega datasheet...

    Why do schools force students to use non-standard compilers?

    avr-dude exists! Gcc!! (not sure if it works for 16 bit)
  • 1
    I was wrong, your compiler already use gcc and avrdude, is not that bad then 😁
  • 1
    @mngr no idea what that entails, but feels good to know it's not as bad as you thought it was
  • 0
    @FMashiro I bought something similar too. Works surprisingly well.
  • 0
    @mrgadget you mean the SD card reader?
  • 0
    @jespersh nah, there were some problems with bit shifting... My bad.

    Later on I had another problem where the cs line would go low when told to, but would never become high again, appears to have been because of the led on the line...

    It's all good and fixed now tho
  • 0
    @FMashiro no sorry. The cheapo Logic Analyser
Add Comment