I'm trying to use an ATTiny85 to store 200 or so bytes in its non-volatile memory, and be able to transfer that to a PC running windows. It seems like the crude USB 1.1 bit-banging emulation code that is available for this little bugger has not been updated in many years. Has there been any more progress made in this area? I still have not figured out how to use this guy, emulating something other than a USB keyboard or mouse. Suggestions? Thanks!
The reason, I suppose, that little forward progress has been made in the recent past is that "Trinket" from Adafruit is 'essentially' V-USB: thus, most Trinket projects are V-USB capable, from the work of Frank Zhao. Also Digispark code examples should be broadly similar, some syntax changes.
Well, I was hoping for a serial port of some sort. Basically, I just need to transfer a couple hundred bytes to the host. Keyboard input is not useful for this application. It seems that most modern (at least Windows) OSes don't like USB 1.1 for more more than mouse/keyboard. So still trying to figure out what is the simplest way of implementing the storage and one-way transfer of a couple hundred bytes of data from the ATTiny to a windows box (running win10).
Do you mean serial input to the tiny85 and then send that over USB?
I pulled out an V-USB project 10 years old, plugged into my Surface Pro w/ Windows 11 and the transfer was flawless. I would expect the same on my Linux Elitebook.
No, I don’t need any serial input. Only need a way to send 200 8-bit bytes to a pc host. The data would be stored in the nvram. I was just thinking that if it emulated a serial port, it would be simple to open the port for reading, and retrieve the data that way. Just trying to find the easiest way to pull this off without requiring special drivers.
The most basic useful data transaction is a control transfer, which carries two parts: a setup packet and a data packet. Basically, the setup packet says how many bytes are in the data packet, and which way the data packet goes. We use control transfers for data going from the computer to the Trinket.
To get data going from the Trinket to the computer, we open an interrupt-in endpoint to send it. The computer will automatically ask "is there anything in the endpoint" once every 2 ms, and if Trinket answers "yes", then the transfer begins.
The middle-man software I wrote (named TrinketFakeUsbSerialHostSW ) will communicate with the Trinket using LibUsbDotNet, which is a libusb-win32 wrapper for C#. The data is relayed to a fake serial port created by com0com.
// edit
And many years back:
/* Tested 20120729 by MRB using Arduino 1.0 / MIT ATtiny85 hardware
PROFILE: attiny85-8.name=ATtiny85 (internal 8 MHz clock)
The baud of 4800 will ACTUALLY be 9600 when the MIT
ATtiny85 hardware profile is used at 8MHz INTERNAL clock with
Arduino 1.0 to write the PROGRAM to the ATtiny85
BUT THE FUSES WERE FLASHED WITH THE ATtiny Google CODE BY
SELECTING: attiny85at16p.name=ATtiny85 @ 16 MHz (internal PLL; 4.3 V BOD)
Output to COM1:: 9600 BAUD 8N1 and terminal program on XP
*/
#include <SoftwareSerial.h>
long count = 0;
// Use 'true' inversion for output to PC
SoftwareSerial oSerial(2, 3, true); // RX, TX from PC perspective
// RX (Phys pin#2) is actually the send (output) from the ATmel to display
void setup()
{
// set the data rate for the SoftwareSerial port
oSerial.begin(4800); // REALLY 9600 with 8MHz internal clock see note above
oSerial.println("....."); // just to start the serial sync
delay (1000);
}
void loop() // run over and over
{
oSerial.print("Now in loop count: ");
oSerial.println(++count);
delay(1000);
}