EverDrive-64 X7

The EverDrive-64 X7 is a flash cart made by Krikzz.

= Serial Communication =

The EverDrive-64 X7 supports serial over USB communication to a host PC. This can be used to load ROMs and allows running ROMs to send an receive data from the host PC. Krikzz provides a reference implementation here.

Serial Registers
The EverDrive-64 X7 provides various registers starting at the address  in the cartridge address space. The following registers are used for USB communcation.

The  register contains various bits as described below

Initializing EverDrive
Below is the code used to initialize the EverDrive to be used for USB IO from krikzz's reference code with comments

The example code sets latency and pulse for the values expected for USB communication. Different devices such as flash, sram, or cartridge would expect different values. You should change these to the appropriate values for the device before doing a DMA to that device. If you are using libultra there is a function designed to configure the PI manager for you before starting a DMA using. The first parameter of this function accepts a pointer to a  which contains the latency and pulse values that should be used by the PI manager.

Sending Data to the Host
Below is the example code for sending data to the host PC in the function. Keep in mind that  should be aligned on 8 byte boundaries since it is used in a DMA transfer. For the same reason the length should be a multiple of 2.

Reading Data from the Host
Below is an example of reading data from the host PC. Since  is used in a DMA transfer it must be aligned to 8 bytes. For the same reason, len should be multiple of 2. The EverDrive-64 X7 also has the limitation that at least 16 bytes must be read. For this reason you should pad data sent to the EverDrive to a multiple of 16 bytes. You also must not read more data than what as been send from the host PC otherwise the read operation will time out while waiting for data that never comes. To solve this you can either prefix data sent to the EverDrive with a header indicating the amount of data being sent or you read data 16 bytes at a time calling  each time to check if there is more data.

Common Code
Code used for both reading and writing