Pages: 1 [2] 3 4   Go Down
Author Topic: Problem with custom Atmega2560 board, cannot use FT232 for Serial comms  (Read 4224 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

There's a utility you can download from ftdichip.com: FT_PROG 2.8.2.0 - EEPROM Programming Utility

http://www.ftdichip.com/Support/Utilities.htm

I got a copy, thinking I could see how the FT232 chip was configured. Well that worked but I couldn't see anything obviously wrong.

Then it occurred to me last night to compare the chip to a working one in a board from another manufacturer. Maybe there is something that is a default that everyone knows to change, like the "divide by 8" bit in the processor.
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 524
Posts: 26454
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmm, could be.  I've never seen anyone ask about that before.
Is it summer there yet? Another snow storm just letting up here, maybe some more snow later tonight too.
http://www.intellicast.com/National/Radar/Current.aspx
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is it summer? We just had a run of about 10 days of over 30C temperature (over 86F). Then at nights it only got down to about 25C (77F). It was hot, damn hot.
Logged

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 33
Posts: 1121
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

We just had a run of about 10 days of over 30C temperature (over 86F). Then at nights it only got down to about 25C (77F). It was hot, damn hot.
Wow.  If that keeps up retiring Victorians (and Neighbours' characters) could cease migrating up here!  I'm pretty sure that was foundation of our state's economic recovery plan too smiley-eek  It's officially Autumn, but here it's raining due to ex-tropical cyclone 'Tim' and we have a warning of another potential cyclone forming up north.  That's xmas weather...it's all gone a bit weird.

Geoff
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Offline Offline
Full Member
***
Karma: 9
Posts: 109
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
The chip/driver must auto-detect the baud rate coming from the processor, and they seem not to be doing as good a job as the 8U2 chip.
How do you mean? Neither the ftdi nor the 8u2's firmware do that, they just impose the baudrate sent over usb by the pc on their uart.

About the theory of overflowing the ftdi's 64 byte buffer. What if you send data only every say 30 msec? (the buffer is flushed over usb after a configurable timeout which is 16msec by default).

How is the ftdi connected? Is there an auto reset line (DTR or RTS) towards the atmega? Are the other flow ctrl signals connected (toggling cts,... flushes the buffer too)
« Last Edit: March 19, 2013, 05:51:05 pm by PeterVH » Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Here is the relevant part of the circuit. Does anything that is floating look as if it should be brought high or low?




Quote
How do you mean? Neither the ftdi nor the 8u2's firmware do that, they just impose the baudrate sent over usb by the pc on their uart.

Oh, OK then. So when the PC/Mac connects at a certain baud rate, it configures the FT232 to expect that baud rate on the "other side"?

Quote
About the theory of overflowing the ftdi's 64 byte buffer. What if you send data only every say 30 msec? (the buffer is flushed over usb after a configurable timeout which is 16msec by default).

I tried a loop sending a letter at a time, with a 100 mS delay, still nothing.

Quote
How is the ftdi connected? Is there an auto reset line (DTR or RTS) towards the atmega? Are the other flow ctrl signals connected (toggling cts,... flushes the buffer too)

See above. I presume any pins without a net name are floating.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I just spotted this in the datasheet:

Quote
When used in Input Mode, the input pins are pulled to VCCIO via internal 200kΩ resistors.
Logged

Wahiawa, Hawaii
Offline Offline
God Member
*****
Karma: 29
Posts: 582
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Nick, do you have any way to verify your 16MHz crystal?  Maybe it's slightly off frequency?

Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 524
Posts: 26454
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Maybe set the fuse for CLKO and carefully probe pin 9 to confirm the system clock?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 199
Posts: 12768
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Output the ASCII table to Serial1 (serial one).  Use a serial-to-USB converter to get the output into your Mac.  If that works, the problem is very likely the onboard converter.  If that does not work, the problem is very likely the 2560.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Nick, do you have any way to verify your 16MHz crystal?  Maybe it's slightly off frequency?

I wrote a sketch that toggles PK4, a pin I can get to:

Code:
void setup ()
  {
  noInterrupts ();
  DDRK |= 1 << 4;  // PK4
 
  while (true)
    PINK |= 1 << 4;  // toggle PK4
  }  // end of setup

void loop () { }

The generated code takes 7 clock cycles:

Code:
132:   80 91 06 01     lds     r24, 0x0106   (2)
 136:   80 61           ori     r24, 0x10       ; 16   (1)
 138:   80 93 06 01     sts     0x0106, r24   (2)
 13c:   fa cf           rjmp    .-12            ; 0x132 <setup+0xc>   (2)

Thus it would be 28 cycles for 4 iterations of the loop (4 x 7). That should take 28 * 62.5 nS, that is 1.75 uS.

Measured at 100 MHz it seems to be taking exactly that:






Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Output the ASCII table to Serial1 (serial one).  Use a serial-to-USB converter to get the output into your Mac.  If that works, the problem is very likely the onboard converter.  If that does not work, the problem is very likely the 2560.

I needed to fire up my RS485 converter as well as the serial-to-USB converter but after doing that, yes the ASCII table appears.
Logged

Global Moderator
Boston area, metrowest
Online Online
Brattain Member
*****
Karma: 524
Posts: 26454
Author of "Arduino for Teens". Available for Design & Build services. Now with Unlimited Eagle board sizes!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

So the FTDI chip is not working then?
Logged

Designing & building electrical circuits for over 25 years. Check out the ATMega1284P based Bobuino and other '328P & '1284P creations & offerings at  www.crossroadsfencing.com/BobuinoRev17.
Arduino for Teens available at Amazon.com.

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I won't quite go that far, because I have uploaded sketches on my Windows PC to it, but not from my Mac. So it works up to a point.
Logged

Global Moderator
Dallas
Offline Offline
Shannon Member
*****
Karma: 199
Posts: 12768
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


Could it be a power problem?  Are you certain the Mac USB port is regulating the voltage to a reasonable range?

Try with a powered hub in the middle.
Logged

Pages: 1 [2] 3 4   Go Up
Jump to: