- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Serial Communicat ion between FPGA and uC boards.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-25-2012 08:11 AM
Hi all!
Newbie in programming microcontroller... a bit less in FPGA.
I'd like to communicate with my SP605 Eval. Board via a self-assembly uC board . The uC board has 2 working USB UART ports. With one I should be able to commands to uC, with the second just sending data to the FPGA via serial port.
So, I programmed the FPGA in a way that when it receives a "s" char the User LEDS on the SP605 blink 3 times.
It works perfectly when sending the command directly from Terminal to the SP605, not when from uC board.
This is the main function flashed on the uC board, which uses the ASF (Atmel Software Framework).
int main(void)
{
uint8_t test_out = 0x73; // s in ASCII
// Initialize the USART0.
init_usart0_();
// Initialize the USART1.
init_usart1_();
// Initialize the clock/osc
init_clocks();
usart_putchar(TERMINAL_USART,test_out); // check if "s" is sent to the terminal
usart_putchar(FPGA_USART,test_out); // send "s" to the FPGA...
return 0;
}
I feel like I have to program the uC differently (i.e. the FPGA_USART driver), but no idea how...
Solved! Go to Solution.
Re: Serial Communicat ion between FPGA and uC boards.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-28-2012 10:41 PM
Hi,
if the RS232 Parameters are set correctly (Baudrate etc.) theere should be no problem with your software.
But there may be problems with your HW setup.
You said that the µC Board has two USB UART ports, so I assume the SP605 also has a USB UART Port.
The problem may be that all of these ports are UART slaves, which can not initiate a connection.
Another problem may be that the terminal only sends data when you press a key, which is probably long after power up.
The µC board does this within milliseconds. Is your FPGA already up and running at that time? Do you have some Button on the board, where you can trigger/repeat the sending routine of the character manually?
Have a nice synthesis
Eilert
Re: Serial Communicat ion between FPGA and uC boards.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-30-2012 02:08 AM
Hi Eilert,
thanks for your advices.
Yes, the RS232 Parameters are all the same (Baudrate, parity and stop bit, etc.). And yes even the SP605 has a USB UART port.
I was thinking about the slave/master configuration. Luckly in the ASF there is a function which sets up the USART to use a synchronous RS232-like protocol in master mode. So I initialized it as master on the uC board but still does not work!
I do not have any button to trigger/repeat the command manually, but the FPGA is already up when flashing the uC board and executing the routine.
QUESTION:
" The SP605 containst the Silicon Labs CP2103GM USB-to-UART bridge device (U4) which allows connection to a host computer with a USB cable"... "Silicon Labs provides royalty-free Virtual COM Port (VCP) drivers which permit the CP2103GM USB-to-UART bridge to appear as a COM port to host computer communications application software (for example, HyperTerm or TeraTerm). The VCP device driver must be installed on the host PC prior to establishing communications with the SP605. Refer to the evaluation kit Getting Started Guide for driver installation instructions."
Now the question : does/how the Silicon bridge device interfere in the communication between the 2 boards? Do I have also to "program/initialize" it somehow on the uC in order to be able to communicate through it with my FPGA??
Da
Re: Serial Communicat ion between FPGA and uC boards.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-30-2012 05:47 AM
Hi,
I think you misinterpreted the datasheet. It refers to a driver that creates a virtual COM port on the PC, which already has a USB host interface.
The CP2103GM still acts as a USB slave. And two USB slaves, even simple USB-UART bridges, can not initiate a connection. (I think there's a market gap that neither Silicon Labs nor FTDI has filled yet.)
Get another PC with two free USB ports, connect the two USB-UARTs to thet board and establish a constant copying from one com port to the other.
On unix/linux something like this could work:
cat ttyS0 > ttyS1 &
cat ttyS1 > ttyS0 &
Have a nice synthesis
Eilert
Re: Serial Communicat ion between FPGA and uC boards.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-31-2012 07:55 AM
Hi,
I get now what you meant with the CP2103G, thx.
It's not still completely clear what you suggested me to do ... In the pic attached it's the configuration you mean. So your hint is to constantly copying from one USB-UART port to the other, no matter how the uC is programmed to do. What this should try to prove?
Da
Re: Serial Communicat ion between FPGA and uC boards.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-31-2012 04:23 PM
eilert wrote:
The CP2103GM still acts as a USB slave. And two USB slaves, even simple USB-UART bridges, can not initiate a connection. (I think there's a market gap that neither Silicon Labs nor FTDI has filled yet.)
USB slave to USB slave direct communication is specifically precluded by the USB spec.
----------------------------------------------------------------
Yes, I do this for a living.
Re: Serial Communicat ion between FPGA and uC boards.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-31-2012 10:34 PM
Hi,
the point is, that the PC has HOST-USB functions.
Copying only happens if there is data available. So if your microcontroller is just sending one byte, this will be transfered to the FPGA via the PC.
The big difference is that the usb connections between the PC and the two targets can be established at all.
That the PC remains transparent doe to the things done by the drivers and OS is just the most simple setup. Of course, this could be expanded to some communication sniffing tool if the communication is more complex.
Surely in the end you want to have a setup that works without the PC. It's just a proof of concept thing here.
There are microcontrollers that can act a s USB host's or at least as USB-OTG devices.
Maybe you should use one of these, and by this also save the external usb-uart bridge on the microcontroller board.
Then a cnnection between such a microcontroller and the FPGA boards USB-UART bridge should be no problem.
Have a nice synthesis.
Eilert
Re: Serial Communicat ion between FPGA and uC boards.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-31-2012 10:52 PM
Hi Bassman.
That's right. So it's time to free the slaves! ;-)
For example, there's the USB-OTG spec, which allows slaves to become hosts with limited functionality.
The example of the OP shows a scenario that could be seen more often now, since the pure RS232 interface with a 9pin Sub-D connector is vanishing. So soon there will be plenty of boards with usb slaves, but no hosts. A quite ridiculous situation, creating some serious problem.
So why shouldn't a advanced USB-UART bridge "mutate" from slave to host (or OTG device) if it somehow identifies a connected device as another USB-UART bridge. (Basically that's the idea behind USB-OTG as I understand it.)
Kind regards
Eilert
Re: Serial Communicat ion between FPGA and uC boards.
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
06-02-2012 05:02 AM
Hi Eilert,
thanks again for you help. You fully answered my question. With the following HW setup a master/slave USB-UART connection is not possible. I will use the PC as a "bypass device" for my implementation.
Regards,
Da











