Continued playing with USB serial stuff. I think it's working well now, but I'm running into problems reading from the SIMM, so I need to figure out why I'm not getting the data I expect.

This commit is contained in:
Doug Brown 2011-12-10 10:35:41 -08:00
parent 1db6834da4
commit 2bc61f41aa
4 changed files with 73 additions and 15 deletions

View File

@ -55,7 +55,7 @@
#define CDC_NOTIFICATION_EPSIZE 8
/** Size in bytes of the CDC data IN and OUT endpoints. */
#define CDC_TXRX_EPSIZE 16
#define CDC_TXRX_EPSIZE 64
/* Type Defines: */
/** Type define for the device configuration descriptor structure. This must be defined in the

View File

@ -20,21 +20,20 @@ void ExternalMem_Init(void)
// Initialize the ports connected to address/data/control lines
Ports_Init();
// Disable all pull-ups, on both the address and data lines. They aren't needed
// for normal operation.
Ports_AddressPullups_RMW(0, (1UL << (HIGHEST_ADDRESS_LINE + 1)) - 1);
Ports_DataPullups_RMW(0, 0xFFFFFFFFUL);
// Configure all address lines as outputs
Ports_SetAddressDDR((1UL << (HIGHEST_ADDRESS_LINE - 1)) - 1);
// Sensible defaults for address and data lines:
// Set all data lines as inputs
Ports_SetDataDDR(0);
// Disable all pull-ups on the data lines. They aren't needed
// for normal operation.
Ports_DataPullups_RMW(0, 0xFFFFFFFFUL);
// Sensible defaults for address lines:
// Write out address zero
Ports_SetAddressOut(0);
// Set all data lines as inputs (with no pullups! we turned them off)
Ports_SetDataDDR(0);
// Control lines
Ports_SetCSDDR(1);
Ports_SetOEDDR(1);

5
main.c
View File

@ -8,6 +8,7 @@
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>
#include "external_mem.h"
#include "tests/simm_electrical_test.h"
#include "usb_serial/usb_serial.h"
@ -18,6 +19,10 @@ int main(void)
DDRD |= (1 << 7);
PORTD &= ~(1 << 7);
ExternalMem_Init();
ExternalMem_SetAddress(0);
ExternalMem_AssertCS();
ExternalMem_AssertOE();
USBSerial_Init();
sei();

View File

@ -8,6 +8,7 @@
#include "usb_serial.h"
#include "../LUFA/Drivers/USB/USB.h"
#include "../Descriptors.h"
#include "../external_mem.h"
USB_ClassInfo_CDC_Device_t VirtualSerial_CDC_Interface =
{
@ -39,7 +40,24 @@ void USBSerial_Check(void)
{
if (USB_DeviceState == DEVICE_STATE_Configured)
{
int16_t rb = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
if (CDC_Device_BytesReceived(&VirtualSerial_CDC_Interface))
{
CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
uint32_t mem = ExternalMem_ReadData();
char dataString[11];
sprintf(dataString, "%02X%02X%02X%02X\r\n",
(mem>>24) & 0xFF,
(mem>>16) & 0xFF,
(mem>>8) & 0xFF,
(mem>>0) & 0xFF);
CDC_Device_SendString(&VirtualSerial_CDC_Interface, dataString);
}
/*int16_t rb = CDC_Device_ReceiveByte(&VirtualSerial_CDC_Interface);
if (rb >= 0)
{
if (rb == '.')
@ -53,14 +71,50 @@ void USBSerial_Check(void)
}
if (gotChar)
{
{*/
//if (CDC_Device_SendByte(&VirtualSerial_CDC_Interface, 'A') != ENDPOINT_READYWAIT_NoError)
if (CDC_Device_SendData(&VirtualSerial_CDC_Interface,
"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", 64) != ENDPOINT_RWSTREAM_NoError)
/*if (CDC_Device_SendData(&VirtualSerial_CDC_Interface,
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
"ASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDFASDF"
, 2048) != ENDPOINT_RWSTREAM_NoError)
{
PORTD |= (1 << 7);
}
}
else
{
PORTD &= ~(1 << 7);
}*/
//}
}
CDC_Device_USBTask(&VirtualSerial_CDC_Interface);