Getting garbage from FTDI

Support forum for the mightyohm.com Geiger Counter.
http://mightyohm.com/geiger
MatejKovacic
Posts: 9
Joined: Fri Dec 23, 2016 1:34 am

Getting garbage from FTDI

Postby MatejKovacic » Fri Jan 06, 2017 10:47 am

Hi,

just received my FTDI cable (TTL-232R-3V3 from Farnell), connect it to my Ubuntu Linux latop and rud sudo cutecom (by default only root has access to /dev/ttyUSB0.

Settings:
Device: /dev/ttyUSB0
Baud rate. 9600
Data bits: 8
Stop bits: 1
Parity: None

Handshake (software and hardware UNCHECKED!)
Open for: reading (CHECKED)

Checked several "line end" settings (LF, CR, CR/LF, hex input).

I get only this:

\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\

Any idea what could be wrong?

MatejKovacic
Posts: 9
Joined: Fri Dec 23, 2016 1:34 am

Re: Getting garbage from FTDI

Postby MatejKovacic » Fri Jan 06, 2017 11:49 am

Actually, there are not only \0x00 characters, there are several other charcters (\0x80, etc.), but it pasted only NULLs.

This is the hexdump contents of (part of) cutecom.log file:
0000000 0080 0080 8080 0080 8080 8000 0000 0000
0000010 0080 8000 0000 8000 8000 8000 8080 0080
0000020 0080 0080 0000 0000 0000 0000 0080 0000
0000030 8080 8080 0080 8080 8000 8080 0080 8000
0000040 0080 8000 8000 0000 0000 0000 0080 0080
0000050 8000 0000 8000 0000 8000 8000 0080 8000
0000060 0080 8080 8080 8080 0080 8000 8000 8000
0000070 8000 8080 8000 0080 0080 0000 0080 0000
0000080 0080 0000 0080 0080 8080 8080 8000 8000
0000090 0000 0000 0000 8000 0000 0080 0000 8080
00000a0 8080 0080 8080 8000 8080 0080 8000 0080
00000b0 8000 8000 0000 0000 0000 0080 0080 8000
00000c0 0000 8000 0000 8000 8000 0080 8000 0080
00000d0 8080 8080 8080 0080 8000 0000
00000db

MatejKovacic
Posts: 9
Joined: Fri Dec 23, 2016 1:34 am

Re: Getting garbage from FTDI

Postby MatejKovacic » Fri Jan 06, 2017 12:04 pm

Huh, I have found something very interesting.

If I connect FTDI cable to Geiger counter and USB, start cutecom and DO NOT turn on the Geiger counter, I am still starting to receive these garbage data.

If I connect FTDI to USB only and not to Geiger counter serial interface, I do not receive any data.

Anyway, if I connect Geiger counter, I am still receiving garbage data. And if I turn Geiger counter off, it is still clicking (but more quiet) - it seems it gets switched on via serial interface???

MatejKovacic
Posts: 9
Joined: Fri Dec 23, 2016 1:34 am

Re: Getting garbage from FTDI

Postby MatejKovacic » Sat Jan 07, 2017 2:28 am

OK, I have found out that it is working, if I set baudrate to 1200.

However, in that case I am getting 8-times higher CPM than it should be.

Since I am not living in a nuclear reactor it clearly seems to be a ATTiny chip programming problem. :)

User avatar
mightyohm
Site Admin
Posts: 952
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Getting garbage from FTDI

Postby mightyohm » Sun Jan 08, 2017 11:52 pm

Did you purchase a kit? If so, the microcontroller should come pre-flashed with the correct firmware and fuse bytes. If not, make sure you set the fuse bytes correctly. The baud rate error is a sure sign that something is wrong with the crystal or clock configuration fuses.

MatejKovacic
Posts: 9
Joined: Fri Dec 23, 2016 1:34 am

Re: Getting garbage from FTDI

Postby MatejKovacic » Tue Jan 10, 2017 2:05 am

Ho, I did not purchase the kit, I made it by myself. In fact, I am also using slightly modified board - it is one sided, and I am using some bricks.

I programmed ATtiny chip with Arduino:
http://www.ernstc.dk/arduino/2313.htm

It seems, I need to modify a geiger.c code a little bit:

After int main(void) I need to add two lines, as shown below:

Code: Select all

int main(void)
{   
   CLKPR = _BV(CLKPCE);
   CLKPR = 0;

   // Configure the UART   
   // Set baud rate generator based on F_CPU
   UBRRH = (unsigned char)(F_CPU/(16UL*BAUD)-1)>>8;
   UBRRL = (unsigned char)(F_CPU/(16UL*BAUD)-1);


Right now, I do not have Arduino with me, but I will test and report is this is working or not.

User avatar
mightyohm
Site Admin
Posts: 952
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Getting garbage from FTDI

Postby mightyohm » Thu Jan 12, 2017 12:01 am

Did you check the fuse bytes? The default fuse bytes will not work, the clock will run very slow. This may explain the issue with the baud rate.

EM2018
Posts: 2
Joined: Sat Feb 04, 2017 4:50 am

Re: Getting garbage from FTDI

Postby EM2018 » Sat Feb 04, 2017 5:04 am

Hello,
I have the same problem. Device made at home by me and ATTINY 2313 (not V) programmed with Arduino UNO. PCB is due to EAGLE schema homemade. It works with SBM-20 and vaseline glass, but always get 1200baud on serial port. Not each 1 second but ever 8 seconds is an output from serial port. I tried to reprogram ATTINY and did not helped. Fuses set due to original or with the FUSE calculator on a website and did not helped. I also switch device to 5V and not to use 74XX for correct 0 1 level from 3V to 5V.

Thanks for any idea or a tip for FUSEs configuration.

EM

MatejKovacic
Posts: 9
Joined: Fri Dec 23, 2016 1:34 am

Re: Getting garbage from FTDI

Postby MatejKovacic » Sat Feb 04, 2017 6:52 am

I am not sure, but you can write the code to a chip with 1 MHz or 8 MHz settings. It could be you are writing it with 1 MHz clock settiing?

EM2018
Posts: 2
Joined: Sat Feb 04, 2017 4:50 am

Re: Getting garbage from FTDI

Postby EM2018 » Sat Feb 04, 2017 4:10 pm

Maybe as you wrote. I setup speed to 8MHz and used arduino for Windows or WinAVR. No success. Now I tried the same burning way in Fedora Linux and works perfectly at first time. So If somebody will have this issue use Linux Arduino SW for burning the ATtiny2313.


Return to “Geiger Counter”

Who is online

Users browsing this forum: No registered users and 0 guests