Page 1 of 1

Serial to USB "FTDI"

Posted: Mon Mar 04, 2013 5:44 pm
by Desdewit
Hi There

I've connected my serial to usb board to my pc via an FTDI chip, installed the FTDI driver and tested the communication with a test program written in basic so I know the hardware is working.
When I use my test program from FC5 the data received by the pc is corrupt.
I've tested both with:
9600baud
One stop bit
No Parity
8 Data bits
No flow control
Oscillator: HS-PLL 32.0000 MHz, 8.0000 MHz Crystal

Re: Serial to USB "FTDI"

Posted: Mon Mar 04, 2013 6:02 pm
by Enamul
Hi,

Not quite clear what you are trying to d here? Can you please tell us what is your goal here?

Re: Serial to USB "FTDI"

Posted: Mon Mar 04, 2013 6:09 pm
by kersing
Have you tried the simple 1 second blink test to check if your clock settings in Flowcode are correct?

Re: Serial to USB "FTDI"

Posted: Mon Mar 04, 2013 6:23 pm
by Desdewit
Hi Enamul & Kersing

I'm trying to send data from my pic serial port to pc via usb.
I know the hardware is working, I've tested it with a program written in basic so the problem must be my setup in flowcode or flowcode self.
I've also done the 1 second test and the timing is ok.

Re: Serial to USB "FTDI"

Posted: Mon Mar 04, 2013 6:30 pm
by Enamul
Hi
I can't see anything wrong in the Flowcode config. It should work easily. Have you tried to send data to PC (terminal or Hyper-terminal) over rs232 from PIC?

Re: Serial to USB "FTDI"

Posted: Mon Mar 04, 2013 6:33 pm
by medelec35
Hi Desdewit,
To enable PLL if required when using internal or external osc.
I thought these devices require a C code block at the beginning with

Code: Select all

st_bit(osctune,PLLEN);
and enable PLL in the configuration menu

What Value crystal or resonator are you using?

I could be wrong of course.
If I'm right, I am surprised the one second test was accurate.
Do you have access to a scope so the baud rate can be measured?

Re: Serial to USB "FTDI"

Posted: Mon Mar 04, 2013 6:59 pm
by Desdewit
Hi medelec

Unfortunately I don’t have a scope but I’ve done the one second test again and it seems pretty close to my pc clock with the c block and pll enabled but still no success.
I’m running a 8MHz Crystal

Almost forgot “I’m also using the second Rx & TX channel of the pic for rs232 to pc and the data received are ok" so the timing must be correct.

Re: Serial to USB "FTDI"

Posted: Tue Mar 05, 2013 1:56 pm
by Mathy
Is it possible to have your schematic ?

I'm working with pic and FTDI chip every day and it works like a charm.

Re: Serial to USB "FTDI"

Posted: Tue Mar 05, 2013 3:44 pm
by Desdewit
Hi Mathy

I'm using the ready for pic board from mikro electronika.
The hardware are working with the hex file from pic basic but not with the hex file from flowcode so this looks like it might be a flowcode error.

Re: Serial to USB "FTDI"

Posted: Tue Mar 05, 2013 7:50 pm
by kersing
Can you connect the FTDI module to the second channel? That works with a serial connection, so speed, bits, etc are set right and it should work with the module as well... If it does we have confirmation there is something suspect with the code for channel one.

Re: Serial to USB "FTDI"

Posted: Wed Mar 06, 2013 6:09 pm
by Desdewit
Hi kersing

Thanks for the reply, Changed the baud to 38400 now it's working.

This is a link to the web page of the board I'm using
The board comes with sample filles to test the hardware.

http://www.mikroe.com/ready/pic/

Re: Serial to USB "FTDI"

Posted: Wed Mar 06, 2013 6:31 pm
by kersing
You had to change the speed of the FTDI adapter to 38400?

Re: Serial to USB "FTDI"

Posted: Tue Apr 02, 2013 9:35 am
by Gary Freegard
Hi Kersing

The baudrate that is selected when the FTDI or equivalent is connect to the PC must be the same value as was programmed into the PIC.
Unless you write some code to automatically change the baudrate of the PIC to match the FTDI, in the RS232 component the is a macro for
changing the baudrate.

Gary

Re: Serial to USB "FTDI"

Posted: Tue Apr 02, 2013 7:03 pm
by kersing
Gary Freegard wrote: The baudrate that is selected when the FTDI or equivalent is connect to the PC must be the same value as was programmed into the PIC.
Hi Gary,

The first message states 9600 bps is used. Later 38400 is mentioned. I was trying to find the answer to the question where adaptions had been made (PIC, FTDI, both?). Having used RS232 components for many years I am very aware of the need to set both sides to the same speed :-)

Best regards,

Jac