Serial to USB "FTDI"
Moderator: Benj
-
- Posts: 130
- Joined: Sat Feb 26, 2011 4:26 am
- Location: South Africa
- Has thanked: 25 times
- Been thanked: 11 times
Serial to USB "FTDI"
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
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
- Attachments
-
- Ready for Pic Test Board.fcf
- (8 KiB) Downloaded 288 times
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: Serial to USB "FTDI"
Hi,
Not quite clear what you are trying to d here? Can you please tell us what is your goal here?
Not quite clear what you are trying to d here? Can you please tell us what is your goal here?
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: Serial to USB "FTDI"
Have you tried the simple 1 second blink test to check if your clock settings in Flowcode are correct?
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
- Posts: 130
- Joined: Sat Feb 26, 2011 4:26 am
- Location: South Africa
- Has thanked: 25 times
- Been thanked: 11 times
Re: Serial to USB "FTDI"
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.
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.
- Enamul
- Posts: 1772
- Joined: Mon Mar 05, 2012 11:34 pm
- Location: Nottingham, UK
- Has thanked: 271 times
- Been thanked: 814 times
Re: Serial to USB "FTDI"
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?
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?
-
- Matrix Staff
- Posts: 9521
- Joined: Sat May 05, 2007 2:27 pm
- Location: Northamptonshire, UK
- Has thanked: 2585 times
- Been thanked: 3815 times
Re: Serial to USB "FTDI"
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
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?
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);
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?
Martin
-
- Posts: 130
- Joined: Sat Feb 26, 2011 4:26 am
- Location: South Africa
- Has thanked: 25 times
- Been thanked: 11 times
Re: Serial to USB "FTDI"
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.
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.
-
- Posts: 130
- Joined: Sat Feb 26, 2011 4:26 am
- Location: South Africa
- Has thanked: 25 times
- Been thanked: 11 times
Re: Serial to USB "FTDI"
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.
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.
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: Serial to USB "FTDI"
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.
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
- Posts: 130
- Joined: Sat Feb 26, 2011 4:26 am
- Location: South Africa
- Has thanked: 25 times
- Been thanked: 11 times
Re: Serial to USB "FTDI"
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/
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/
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: Serial to USB "FTDI"
You had to change the speed of the FTDI adapter to 38400?
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis
-
- Posts: 45
- Joined: Mon Nov 07, 2011 6:36 pm
- Has thanked: 1 time
- Been thanked: 30 times
Re: Serial to USB "FTDI"
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
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
-
- Valued Contributor
- Posts: 2045
- Joined: Wed Aug 27, 2008 10:31 pm
- Location: Netherlands
- Has thanked: 553 times
- Been thanked: 1081 times
Re: Serial to USB "FTDI"
Hi Gary,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.
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
“Integrity is doing the right thing, even when no one is watching.”
― C.S. Lewis
― C.S. Lewis