AVR32 USB Host and 635

ElmerFudd

New member
So I setup my AVR32 (UC3A0256) in host mode and can read the FTDI USB descriptors (on the 635) . The USB host on the AVR32 supports Full Speed (fyi, I'm learning the USB protocol as I develop this..)

I have this spit out on my terminal display:
"Device connected
VID=403, Product ID=FC0D
Number of Endpoints 2
Pipe Number = 1, Interrupt Period =0, End Point Addr =1, Type =2 (bulk), In/Out=1, Size =64
Pipe Number = 2, Interrupt Period =0, End Point Addr =2, Type =2(bulk), In/Out=0, Size =64
Device enumerated" -> I set up the FTDI USB device to be address 4.

When the FTDI USB device is enumerated the default display comes up on the LCD (Crystalfontz CFA-635 etc). It didn't do this until it was enumerated..

I poll the Display and get I continuously read "0x01 0x60" regardless of what I send it (or buttons I push).

Looking at the documentation for the display
TTcc cccc
|||| ||||--Command, response, error or report code 0-63
||---------Type:
00 = normal command from host to XES635BK
01 = normal response from XES635BK to host
10 = normal report from XES635BK to host (not in
direct response to a command from the host)
11 = error response from XES635BK to host (a packet
with valid structure but illegal content
was received by the XES635BK)

-- I'm not sure what to make of this response..

I put a usb sniffer on my PC and hooked up the display and I see the same thing, but I can send commands to it using the 635_Wintest_1_0 app. See below..

-----------------------------------------------------------------------------------------------
857730: Bulk or Interrupt Transfer (UP), 24.09.2010 11:30:15.058 +0.015. Status: 0x00000000
Pipe Handle: 0x9a072dc8 (Endpoint Address: 0x81)
Get 0x2 bytes from the device
01 60 .`
857732: Bulk or Interrupt Transfer (DOWN), 24.09.2010 11:30:15.074 +0.015
Pipe Handle: 0x9a072df8 (Endpoint Address: 0x2)
Send 0x1a bytes to the device
1F 16 00 00 20 20 20 20 20 20 20 20 20 20 20 20 ....
20 20 20 20 20 20 20 20 51 85 Q…
857734: Bulk or Interrupt Transfer (UP), 24.09.2010 11:30:15.074 +0.0. Status: 0x00000000
Pipe Handle: 0x9a072dc8 (Endpoint Address: 0x81)
Get 0x2 bytes from the device
01 60 .`

857736: Bulk or Interrupt Transfer (DOWN), 24.09.2010 11:30:15.074 +0.0
Pipe Handle: 0x9a072df8 (Endpoint Address: 0x2)
Send 0x1a bytes to the device
1F 16 00 01 53 70 65 65 64 20 20 20 20 20 20 20 ....Speed
20 20 20 00 02 04 06 20 77 5A .... wZ
------------------------------------------------------------------------------------------------------
Is the 0x01 0x60 part of the FTDI driver interface? and am I missing the Corresponding command to send to the driver before it will send data to the display? I've been digging through FTDI examples but everything seems to have a PC OS associated with it and I'm not sure what I'm looking for.. The "0x1F" command is what I'm trying to send to it (I calculated the 0x5A77 crc value just like last packet above).

I'm not sure where to look at this point as don't have the ability to monitor the traffic between the AVR32 and display.. I'm hoping the "0x01 0x60" leads me to the key that I'm looking for..

Any help is most appreciated.
ef.
Looking for additional LCD resources? Check out our LCD blog for the latest developments in LCD technology.
 
USB LCD Displays - Graphic and Character LCDs with a Keypad

CF Tech

Administrator
We only use the FTDI parts as devices under Linux or Windows, so we do not have experience writing to the chip at this level.

Once you get bytes to come out of the FTDI's serial side at the right baud rate, we can help, but up to then we will not be of much assistance :(

You might try:

1) look for an AVR USB application that already talks to the FTDI chip

2) look at the source for the Linux driver for the FTDI chip, and emulate what they do
 

ElmerFudd

New member
Hey Thanks for the reply, yeah, I figured as much, trust me, I looked for an app on the net, if there is one, I couldn't find it (found some linux drivers though -they kind of pointed me in the right direction).

So I did it the hard way and figured out the control values being sent to the FTDI chip (not fun).. Long story short, It works! I can go home now...:D

ef

- If anybody finds a library though, lemme know..
 

Pepi

New member
Ftdi

Hey,
I have the same problem right now. How did you figured out ? I have avr32uc3a0512 and I need to test convertor USB/RS232 with FTDI so I imeplemented into AVR32 host mode. I can read VID, PID and enumerate it, but I dont know how read and sent data. I still get the same frame 0x01 0x60. Can zou give me advice?

Thx
 

Twitch

New member
Hey,
I have the same problem right now. How did you figured out ? I have avr32uc3a0512 and I need to test convertor USB/RS232 with FTDI so I imeplemented into AVR32 host mode. I can read VID, PID and enumerate it, but I dont know how read and sent data. I still get the same frame 0x01 0x60. Can zou give me advice?

Thx
I'm having the same issue.. trying to send data through USB from Atmega32 thru FT232RL chip. USB sniffer shows 01 06 (HEX) being sent, but nothing else.. If anyone has a fix...

Edit: VID PID displaying, have FDTI drivers successfully installed and device is recognized. WinXP system.
 

Twitch

New member
Hmm.. apparently 01 06 is the PID (6001) in the form lsb,msb . . so in that case I'm just getting no output..

Shouldn't the FT232RL just relay whatever I send its RXD port from my MCU??
 

Twitch

New member
Using a Serial Capture program, my output appears as C2 nul E6 nul DE FE stx FF
(trying to send B0 7B 90 24 50 @ 31250 baud)

I tried disconnecting the MCU and I can successfully echo characters by connecting the RXD and TXD pins, so must be a coding issue?

The relevant section of my MCU code is as follows:


/********
Includes
********/

#include <avr/io.h>
#include <stdio.h>
#include <stdbool.h>
#include <util/delay.h>

/*****************
Defines
*******************/

#define BAUD 31250
#define MYUBRR F_CPU/16/BAUD-1
#define F_CPU 1200000 // AVR clock frequency in Hz, used by util/delay.h

/*******************
Function Prototypes
********************/

void usart_init(uint16_t ubrr);
void usart_putchar( unsigned char data );

/*******
Main
********/

int main(void)
{
// fire up the usart
usart_init ( MYUBRR );

while(1)
{

// turn off all notes
usart_putchar(0xB0);
usart_putchar(0x7B);

_delay_ms(500); // delay .5s

// turn on C2 MED
usart_putchar(0x90);
usart_putchar(0x24);
usart_putchar(0x50);

_delay_ms(500); // delay .5s
}
}


/*********
USART
**********/

void usart_init( uint16_t ubrr)
{
// Set baud rate
UBRRH = (uint8_t)(ubrr>>8);
UBRRL = (uint8_t)ubrr;

// Enable receiver and transmitter
UCSRB = (1<<RXEN)|(1<<TXEN);

// Set frame format: 8data, 1stop bit default high, implied start bit default low
UCSRC = (1<<URSEL)|(3<<UCSZ0);
}

void usart_putchar(unsigned char data)
{
// Wait for empty transmit buffer
while ( !(UCSRA & (_BV(UDRE))) );

// Start transmission
UDR = data;
}
 
Top