It is currently Sun Oct 22, 2017 4:02 pm

All times are UTC - 7 hours



Forum rules


Related:



Post new topic Reply to topic  [ 35 posts ]  Go to page 1, 2, 3  Next
Author Message
PostPosted: Fri Aug 26, 2016 4:30 am 
Offline

Joined: Fri Aug 26, 2016 3:42 am
Posts: 8
My idea is to crossdevelope on pc, sending the resulting rom over USB, resetting the SNES which will instantly run the code. Is this possible with the SD2SNES? As I cannot find any information about it, my guess is unfortunately that this is not yet implemented, or in worst case not even possible with the architecture. I would be very happy for a heads up over the situation.


Top
 Profile  
 
PostPosted: Fri Aug 26, 2016 11:43 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
To my knowledge there is no "public" documentation regarding what the USB port can do -- only speculative things stated on forums. "Development" is the only thing that has ever been stated semi-definitively, which is a vague statement in itself.

If you want a definitive answer, then it's possible to get one: ask Krikzz or Ikari.

Otherwise, I would suggest looking around to see if there is something like an "SD card emulator", which would be a piece of hardware with, a USB port (or something) that you'd hook to your PC and manage/maintain through software on there -- and on the other end, an SD card/connector which you'd insert into the SD2SNES. I don't know if something like this exists.

Point: back in the day, console copiers had parallel ports for this purpose, but the software and interface was finicky (I even wrote a LPT transfer utility myself), sometimes working for a few transfers then failing (requiring either a PC reboot or a power-cycle of the copier). So, most of us got used to using floppy disks: assemble code on a PC, copy the resulting .smc to the floppy, eject it, put it in the copier, power-cycle the copier, load the file, see the results, rinse lather repeat.

Today, you have SNES emulators. I suggest using them to make your life easier, then when you get something that seems to be working well on several emulators, try it on actual hardware.


Top
 Profile  
 
PostPosted: Fri Aug 26, 2016 12:35 pm 
Offline

Joined: Sat Apr 25, 2015 1:47 pm
Posts: 329
Location: FL
At one point I got the idea to use WiFi enabled SD cards to do basically the same thing, but never actually tried it. Assuming it actually worked, it would have basically been an expensive novelty compared to just doing most of the testing in an emulator.


Top
 Profile  
 
PostPosted: Fri Aug 26, 2016 2:31 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10066
Location: Rio de Janeiro - Brazil
I didn't even know Wi-Fi SD cards existed! Can you really send files to them remotely? Or is the Wi-Fi only meant for sharing the contents of the SD card with other devices?


Top
 Profile  
 
PostPosted: Fri Aug 26, 2016 2:43 pm 
Online

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6296
Location: Seattle
There's both the plain "wifi in SDIO form factor" thing, which is really more of a wireless card that one interacts with using SPI, as well as things like the EyeFi which will use local flash as a cache and upload things over wifi to some configured server.

I don't remember a thing that's useful in the other direction, equivalent to "here's a windows share on an SD card", but it probably exists.


Top
 Profile  
 
PostPosted: Fri Aug 26, 2016 5:47 pm 
Offline

Joined: Sat Apr 25, 2015 1:47 pm
Posts: 329
Location: FL
Toshiba's FlashAir cards are bidirectional, but I have no idea how well they work otherwise (or would work in a sd2snes).

Back to the actual topic, ikari posted a comment some time ago with some info about future USB functionality, and the already-existing serial UART (that I totally forgot about) here: https://sd2snes.de/blog/archives/370#comment-645752

Quote:
As for USB, yeah I have something in mind for that but the implementation details are still foggy… I’d like to provide an upload/configuration interface as well as a console that can be used to log things from the SNES side.
If you want to upload by wire right now, you can use the serial UART console. It’s available on the 14-pin header on the side of the board, using the pins marked TX3 and RX3 (there’s a pinout table printed on the PCB). It speaks 3.3V 115200 8N1, no flow control, and supports xmodem uploads. When the sd2snes is running you enable the serial console by sending an ESC character. It prompts you with a ‘> ‘.
Relevant commands are put <filename> and load <filename>.
put <filename> requests an xmodem transfer from your side. It might take a longer time for the transfer to start (~30s) if you don’t respond within three seconds… I’m not sure why. Might as well be some issue with my specific xmodem client…
load <filename> loads a ROM and executes it, returning to the prompt.
The console supports some other commands that might be handy, such as memory reads and writes, and hex dumps (all on sd2snes on-board memory only, no SNES WRAM, sorry ^^)
The sd2snes’s memory sharing technology allows you to read and write memory while your code is running.
There is no command reference at the moment but take a look at cli.c to get an idea: https://github.com/mrehkopf/sd2snes/blo ... /src/cli.c


Top
 Profile  
 
PostPosted: Sun Aug 28, 2016 12:38 am 
Offline

Joined: Fri Aug 26, 2016 3:42 am
Posts: 8
Ok, thank you all! As I suspected, nothing is really implemented yet. UART would be quite slow I suspect, and regarding wifi SD cards, I have never seen one able to receive data (only send). Anyway, for now I was only curious over the USB port and not about other options. For now it seems like it's not usable for what I want to do.


Top
 Profile  
 
PostPosted: Sun Aug 28, 2016 6:03 am 
Offline

Joined: Thu Feb 07, 2013 1:15 am
Posts: 95
Location: Sweden
johey wrote:
Ok, thank you all! As I suspected, nothing is really implemented yet. UART would be quite slow I suspect, and regarding wifi SD cards, I have never seen one able to receive data (only send). Anyway, for now I was only curious over the USB port and not about other options. For now it seems like it's not usable for what I want to do.

Ah, that was in response to my question... I never got around to fit a nice little serial interface on my SD2SNES, but since nothing's happened with the USB interface since then maybe it's time now. 115200bps isn't too bad compared to the current alternative for testing a ROM (eject SD from SD2SNES, insert in computer, mount, copy file, eject, insert, navigate to file via the sd2snes interface...). At least not when working with a 64KB image, which is usually enough for testing stuff. Having the serial connection active for some caveman debugging while the code is running is pretty nice as well.

This cable should do the trick, right? PL2303HX-USB-to-TTL-Serial-Cable


Top
 Profile  
 
PostPosted: Sun Aug 28, 2016 10:52 am 
Offline

Joined: Thu Feb 07, 2013 1:15 am
Posts: 95
Location: Sweden
Serial cable and header strip ordered! Thinking about usage, it would indeed be neat to facilitate printing from the SNES side via an MMIO register. Maybe right above the MSU-1 registers at $00-3f:2008/$80-bf:2008. While connected, any bytes written there would simply be printed over the TTY.


Top
 Profile  
 
PostPosted: Tue Aug 30, 2016 12:53 am 
Offline
User avatar

Joined: Wed Aug 05, 2015 2:22 pm
Posts: 18
Hi, a year ago i patched the sd2snes firmware for usb uploads.
Yesterday i posted a link on another forum and sanni reminded me, that here is an active thread on this topic, too.
It's a good idea to have the USART Adapter connected as well for debug outputs. ^^

Example:

Upload rom + sram - COM4
./usb2snes --device=4 --sram --write --file=myrom.srm
./usb2snes --device=4 --write --file=myrom.smc
./usb2snes --device=4 --boot


Hint:
some games have an additional 512byte backup unit header,
use the --skip option here


greetings, saturnu


Attachments:
File comment: linux 64bit static binary
linux_bin_64bit.zip [335.42 KiB]
Downloaded 40 times
File comment: firmware
sd2snes_firmware_v0.1.7c_usb.zip [304.7 KiB]
Downloaded 50 times
File comment: upload tool windows port
usb2snes_v04_win32.zip [36.13 KiB]
Downloaded 42 times


Last edited by saturnu on Tue Aug 30, 2016 1:17 am, edited 2 times in total.
Top
 Profile  
 
PostPosted: Tue Aug 30, 2016 1:10 am 
Offline
User avatar

Joined: Wed Aug 05, 2015 2:22 pm
Posts: 18
If you still need to upload via USART, here is my old xmodem upload script.

Serial upload-script for linux v0.1

What's needed:
USB to UART with +3.3V TTL Adapter
i'm using a PL-2303HX
http://www.dx.com/p/pl2303hx-usb-to-ttl-converter-module-149859#.U_HgrnWfnIY

Connection:
sd2snes 14-pin-connector 6 (TX3) to uart RX
sd2snes 14-pin-connector 7 (RX3) to uart TX

Howto:
- install the minicom and lrzsz packages

- add user to uucp group
# usermod -a -G uucp saturnu

- relogin the user

- start and config minicom once
115200 8N1
no flowcontrol

- set the script executable
# chmod +x upload.sh

- start the script with filename and device
# ./upload.sh homebrew.sfc /dev/ttyUSB0

- wait until script asks to start the snes
- wait until game starts

upload.sh
Code:
#!/bin/bash

if [[ $# -eq 0 ]] ; then
    echo 'sd2snes uploader script - by saturnu'
    echo 'upload.sh <file> <device>'
    echo 'upload.sh test.smc /dev/ttyUSB0'
    exit 0
fi

TMP_BN=$(basename $1)
TMP_DN=$(dirname $1)

cat xmodem.script | sed -e 's/fname/'$TMP_BN'/' -e "s|path|"$TMP_DN"/|g" > xmodem.tmp

minicom -D $2 -S xmodem.tmp
rm xmodem.tmp




xmodem.script
Code:
verbose on
print "script loaded - please start snes"
sleep 2

expect {
      "ok"
      timeout 10 goto panic
     }

print "\nneed prompt\n"
sleep 1
send "^["


expect {
    ">"
  timeout 10 goto panic
}
print "set filename\n"
send "put fname"

expect {
    "OK, start xmodem transfer now."
}
! sx pathfname

expect {
    ">"
}
send "load fname"

panic:
 ! killall -20 minicom


Top
 Profile  
 
PostPosted: Tue Aug 30, 2016 3:24 am 
Offline

Joined: Thu May 15, 2008 4:05 am
Posts: 25
saturnu wrote:
Hi, a year ago i patched the sd2snes firmware for usb uploads.
Yesterday i posted a link on another forum and sanni reminded me, that here is an active thread on this topic, too.
It's a good idea to have the USART Adapter connected as well for debug outputs. ^^


You should do a merge request to integrate it in the official repos.

Thanks anyway, i will test that tonight.

Do you think it might be possible to have a linux / macosx build of usb2snes ?

_________________
https://twitter.com/Lint_
http://snesdev.antihero.org/ [depecated blog, new one coming one of these days]


Top
 Profile  
 
PostPosted: Tue Aug 30, 2016 4:07 am 
Offline
User avatar

Joined: Wed Aug 05, 2015 2:22 pm
Posts: 18
ikari_01 has the firmware patchset and source since about a year now. ^^
he is still busy with other features that have a higher priority for him, like an upcoming wallpaper support. (but it's still on the agenda)
i've already attached a linux 64bit static binary as well.

as the business man says, "in the long run we are all dead". :D
so i decided to release it as an interim solution anyway.


if someone really needs to improve this for personal needs, i can upload the source to my github account. ^^


Top
 Profile  
 
PostPosted: Tue Aug 30, 2016 4:33 am 
Offline

Joined: Thu May 15, 2008 4:05 am
Posts: 25
saturnu wrote:
if someone really needs to improve this for personal needs, i can upload the source to my github account. ^^


I would not mind to have access so I can make a osx build. ;)

_________________
https://twitter.com/Lint_
http://snesdev.antihero.org/ [depecated blog, new one coming one of these days]


Top
 Profile  
 
PostPosted: Tue Aug 30, 2016 6:37 am 
Offline
User avatar

Joined: Wed Aug 05, 2015 2:22 pm
Posts: 18
here is the link to the github repo, if you want to compile the upload tool under osx

https://github.com/saturnu/usb2snes


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 35 posts ]  Go to page 1, 2, 3  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: AWJ, Google [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group