[Tutorial] Printing Spla2n Posts with an Arduino/Teensy Board!

Discussion in 'Switch - Hacking & Homebrew' started by dj505, Aug 25, 2017.

?

Which AVR are you using?

  1. An atmega32u4 based board

    11.8%
  2. An at90usb1286 based board

    35.3%
  3. An Arduino Uno R3 board

    52.9%
  1. GomiHiko

    GomiHiko Newbie

    Newcomer
    9
    7
    May 9, 2017
    United States
    I'm having a problem. When I try to type "make" in the SwitchFightstick directory, It says "
    'make' is not recognized as an internal or external command, operable program or batch file." I have MinGW installed and added to the path and I have rebooted several times. How can I fix this?
     


  2. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    519
    119
    Oct 4, 2014
    Canada
    Most likely at the arcade
    I think you mixed up the USB bit; The Teensy has a Mini USB port on the board itself, which you plug a Mini USB to USB type A cable into. You then plug the USB type A end into the USB A to C adapter to plug into the Switch. Here's a handy diagram.

    And did you miss the part where I specifically said to extract the repo into a folder? Literally the first step, I say to extract the contents into a folder of your choice. In fact, that's what the entire first section of the guide is specifically setting up. I already had MinGW and everything installed and could not remember the name of the packages necessary, and most people should be able to figure out what I meant by the "basic package".

    Path for LUFA is likely incorrectly configured in the makefile. Open the makefile in a text editor and replace "../LUFA/LUFA" with "./LUFA/LUFA", and if that doesn't work just type "./LUFA"

    I noticed a typo that I had saying that the path was "C:\WinGW" and not "C:\MinGW", that might be the problem. Fixed it in the guide itself for future reference
     
    Last edited by dj505, Aug 31, 2017
  3. Hopeywolf

    Hopeywolf Newbie

    Newcomer
    6
    0
    Jun 26, 2017
    United States
    Ok i got that sorted but now i ran into another error

    [GCC] : Compiling C file "Joystick.c"
    avr-gcc -c -pipe -gdwarf-2 -g2 -mmcu=at90usb1286 -fshort-enums -fno-inline-small-functions -fpack-struct -Wall -fno-strict-aliasing -funsigned-char -funsigned-bitfields -ffunction-sections -I. -DARCH=ARCH_AVR8 -DF_CPU=16000000UL -mrelax -fno-jump-tables -x c -Os -std=gnu99 -Wstrict-prototypes -DUSE_LUFA_CONFIG_HEADER -IConfig/ -I. -I./LUFA/LUFA/.. -DARCH=ARCH_AVR8 -DBOARD=BOARD_NONE -DF_USB=16000000UL -MMD -MP -MF obj/Joystick.d Joystick.c -o obj/Joystick.o
    Assembler messages:
    Fatal error: can't create obj/Joystick.o: No such file or directory
    make: *** [obj/Joystick.o] Error 3​
     
  4. GomiHiko

    GomiHiko Newbie

    Newcomer
    9
    7
    May 9, 2017
    United States
    When I try to make, I get

    The system cannot find the path specified.
    'avr-size' is not recognized as an internal or external command,
    operable program or batch file.
    'avr-size' is not recognized as an internal or external command,
    operable program or batch file.
    ' [INFO] :' Begin compilation of project \"Joystick\"...
    ""
    process_begin: CreateProcess(NULL, avr-gcc --version, ...) failed.
    make (e=2): The system cannot find the file specified.
    LUFA/LUFA/Build/DMBS/DMBS/gcc.mk:154: recipe for target 'build_begin' failed
    mingw32-make: *** [build_begin] Error 2
     
  5. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    519
    119
    Oct 4, 2014
    Canada
    Most likely at the arcade
    -snip-
     
    Last edited by dj505, Sep 9, 2017
  6. WiiFoundLove

    WiiFoundLove GBAtemp Regular

    Member
    197
    62
    Jan 18, 2015
    Afghanistan
    Is there a reason why this is only for Ardunio/Teensy board? Or does it also works on a Raspberry PI?
     
  7. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    519
    119
    Oct 4, 2014
    Canada
    Most likely at the arcade
    Teensy and (some) Arduino boards use chips like the atmega32u4, at90usb1286, atmega16u2, etc. which are all programmable via USB, and act as USB HID decides. The Raspberry Pi is a full computer and not just a programmable AVR, so it won't work.
     
  8. Hopeywolf

    Hopeywolf Newbie

    Newcomer
    6
    0
    Jun 26, 2017
    United States
    So I was able to get it working but it seems that the brush it selects is the larger one which the image turns into a mess after. How can i fix that
     
  9. HamBone41801

    HamBone41801 K35

    Member
    576
    333
    Jan 16, 2017
    United States
    technically, the raspberry pi is a usable device, just not via this method. (and also, the method that would use it will never exist.) you would need to write, build, and install a bare-bones program to do everything, which is impossible unless you are familiar with asm.
     
  10. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    519
    119
    Oct 4, 2014
    Canada
    Most likely at the arcade
    You'll need to select a different tool beforehand instead of setting it to the smallest one so that when the tool does change, it changes to the smallest one automatically. It's a weird thing that happens sometimes, not sure why.

    Edit: I see you got it working lol
    Warning: Spoilers inside!
     
    Last edited by dj505, Aug 31, 2017
  11. GomiHiko

    GomiHiko Newbie

    Newcomer
    9
    7
    May 9, 2017
    United States
    I managed to fix it by adding C:\Program Files (x86)\Arduino\hardware\tools\avr\bin to my PATH with the arduino IDE installed. I also used the command mingw32-make instead of make and added my flip installation folder as the driver location for my arduino uno while in DFU mode in device manager. It all worked and it's drawing as we speak.
     
  12. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    519
    119
    Oct 4, 2014
    Canada
    Most likely at the arcade
    Alright, good to know! I'll add this to the guide when I have a few minutes
     
  13. Hopeywolf

    Hopeywolf Newbie

    Newcomer
    6
    0
    Jun 26, 2017
    United States
    Is there a way to invert the black and white?
     
  14. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    519
    119
    Oct 4, 2014
    Canada
    Most likely at the arcade
    Yep. In GIMP, go to Colors > Map > Rearrange Colormap and swap the positions of black and white (should just be drag and drop), then save and print again
     
  15. crk14341

    crk14341 Newbie

    Newcomer
    3
    0
    Aug 30, 2017
    United States
    So I've managed to fix a few of the issues that I've been having however I've come across a new problem that I can't figure out. What should I do to fix this?
     

    Attached Files:

  16. Vverg

    Vverg Member

    Newcomer
    22
    8
    Jan 5, 2017
    Netherlands
    Well.. I'm trying to do this stuff with a ATMEGA32U4.

    Anyways you talk about Joystick.hex but I dont see anywhere in the tutorial how I can make this (as in making it for the stick i have). I do read something about makefile thing... but no idea how I exactly can run this.

    And my guess is that I eventually have to put this in cmd?

    Code:
    "C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude" -C "C:\Program Files (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf" -v -patmega32u4 -cavr109 -PCOM4 -b57600 -D -Uflash:w:E:\SwitchFightstick/Joystick.hex:i
     
  17. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    519
    119
    Oct 4, 2014
    Canada
    Most likely at the arcade
    Everything you need to do is in the guide. Install the necessary things and read it step by step. When you get to the part where there are 3 different boards, use the atmega32u4 section. You can just copy/paste the commands I have in the guide.

    You get joystick.hex by compiling the program, which you do by editing the makefile to compile for the atmega32u4. The .hex file is the actual code you flash to the AVR once compiled.
     
    Last edited by dj505, Sep 6, 2017
  18. Vverg

    Vverg Member

    Newcomer
    22
    8
    Jan 5, 2017
    Netherlands
    Well I really can't see in the guide where I have to compile it.

    Anyways, I decided to investigate it myself trough Google and found out that "mingw32-make" in CMD in the Switch folder did the trick. Had to download the joystick.o stuff but I finally got my Joystick.hex.

    (Edit: I see GomiHiko had the same issue, stupid I dind't see it before.)

    But then the issue came for writing the stuff to the Arduino stick, it simply dind't want to "reset" it... I don't have a reset button on my "Beetle atmega32u4 mini dev board". After some searching (+ give it some of my own touch) I discovered that if I change the baudsetting in Devicemanager to 1200 Baud... then change the command line also to 1200 Baud... (the one where you write the hex) I hear the connect/disconnect sound from Windows. But it jumps to other COM port after the reset, so I have to use that cmd line first with the first COM port (which was COM5 for me) and then the second (COM7).

    Though I dind't needed to change stuff in the Arduino IDE program, it simply switched the COM port automatically for me after the first reset.

    Now I have to wait for my USB C > USB A (female) stick (cant find the one I had). So I expect I can test the result tomorrow.
     
    Last edited by Vverg, Sep 6, 2017
  19. dj505
    OP

    dj505 Inexperienced Romhacker

    Member
    519
    119
    Oct 4, 2014
    Canada
    Most likely at the arcade
    You can use the dock USB ports to test (won't work 100% right but it's possible for now) until your adapter arrives.

    And the make instructions are in the guide, yes. Once everything is installed it's as simple as typing "make"; again, everything is in the guide. You have to read it in order, start to end, without skipping parts.
     
  20. Vverg

    Vverg Member

    Newcomer
    22
    8
    Jan 5, 2017
    Netherlands
    But that simply dind't work for me, if you look up GomiHoki had the exact same issue as me.
    I pretty much read and checked all your steps 10x to make sure I did exactly everything you said.

    Aaah yeah I do see it "working" in dockmode, so guess I'm ready for now :)