The following warnings occurred: | |||||||||||||||
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.1.32 (Linux)
|
![]() |
Sending data from RAM to USB - Printable Version +- CBMSTUFF FORUM (https://www.cbmstuff.com/forum) +-- Forum: CBMSTUFF PRODUCTS (https://www.cbmstuff.com/forum/forumdisplay.php?fid=1) +--- Forum: SuperCard Pro (https://www.cbmstuff.com/forum/forumdisplay.php?fid=3) +---- Forum: Developer Area (https://www.cbmstuff.com/forum/forumdisplay.php?fid=13) +---- Thread: Sending data from RAM to USB (/showthread.php?tid=287) |
Sending data from RAM to USB - dfstudios - 01-18-2016 Hi there, I've been experimenting with writing some software to control SCP. Everything I've done so far works okay, apart from sending data from the on-board RAM to the USB port as I keep getting a pr_CommandErr return code. Could someone please explain to me in more detail how to use this function? Kind regards, Francis RE: Sending data from RAM to USB - admin - 01-18-2016 Ok, so for your error: pr_CommandErr = 0x02 ; command error (bad structure, etc.) This means that you are not passing the correct data as a command. Note the description of the command 0xA9: Code: (Command.b, Payload Length.b, RAM_Offset.l, TransferLength.l, Checksum.b) Typically, people forget that the RAM offset and transfer length are in BIG endian format. You should be able to send this hex string command to test the command: 0xA9 0x08 0x00 0x00 0x00 0x00 0x00 0x00 0x01 0x00 0xFC That will transfer 0x00000100 (256 bytes) of data from location 0x00000000 in the RAM to the USB port. Immediately after the 256 bytes of data will be 0xA9 0x4F as the response code. Let me know if you have any issues! RE: Sending data from RAM to USB - dfstudios - 01-18-2016 Thanks for the quick reply. I was able to get your example working, but mine would still fail. It wasn't until I did a byte by byte debug output of the packets being sent I realised I had a typo for the payload buffer (meaning that there was no payload being sent)! Oops! ![]() Working now though. ![]() Kind regards, Francis RE: Sending data from RAM to USB - admin - 01-18-2016 Good to hear you got it working. What are you working on? RE: Sending data from RAM to USB - dfstudios - 01-19-2016 At the moment I'm just experimenting. I'm not sure yet how far I will take it. Kind regards, Francis RE: Sending data from RAM to USB - admin - 01-19-2016 There is example C code for comtrolling the SuperCard PRO and manipulating the image file format. RE: Sending data from RAM to USB - dfstudios - 01-27-2016 I'm aware that there is some C code, but I'm not really a C programmer (I mostly use PureBasic) plus I prefer to try things by myself rather than looking at someone else's code (unless I really have to). I find I learn better that way, by making my own mistakes! ![]() Something I noticed while trying to copy data from the onboard RAM to USB is that there seems to be a 64K limit on the amount of data that can be sent in one go. Is this correct? Kind regards, Francis RE: Sending data from RAM to USB - admin - 01-27-2016 The limit is 512KB, because that is the amount of memory on the board. ![]() RE: Sending data from RAM to USB - dfstudios - 01-27-2016 So I should be able to request and receive the 512k in one go? At the moment I am only able to receive it in 64k (i.e. exactly 65,536 bytes) chunks. ![]() Kind regards, Francis RE: Sending data from RAM to USB - admin - 01-27-2016 Yes, you get as many bytes sent as requested. I looked at PureBasic, and it looks to be a bit slow from the serial port side at the max baud rate of 115,200 if you are not using hardware handshaking (which the FTDI driver supports). If you are using the USB COM port without handshaking, you probably need a baud rate of 500,000 or more. The buffer on the FTDI chip is 4K, but the buffer in the COM port is 64K. I am not sure how you can open a .dll with PureBasic, but if that is possible you could use the transfer routines in the FTDXXX.dll instead of opening a COM port. |