Forum > General

Receiving serial string with 5DPO

<< < (3/3)

At work I write flash download stuff, we have a 16-bit DSP with a bootloader to receive data and program the Flash, and a PC app to read a file and send it to the DSP. I've been writing the interrupt driven code on the DSP and the PC app code, the difference in approach is quite interesting, I have to wear two completely different hats...

The funny thing is that the DSP is 80Mhz with 8KB of RAM, the PC is 3GHz with 4GB of RAM, yet nearly all the delay is in the PC side, and not the comms (38K RS232) or the Flash programming. I can minimise the delay by using 80% of the CPU, but that's not very friendly.

I could improve it more with a different comms protocol, but I can't change that.

It was long time ago that I have used RS232.
In this site:
we have a complete information about dealing with serial, parallel and USG ports,
with programming examples.
Maybe this can help.

mas steindorff:
I too agree with bobc.  I'm using 1 Mbps setting but I use serial to usb hardware on the PC end.  The drivers work best when my app uses the block read as opposed to the byte by byte approach but that is also how the hardware works (USB blocks of 400 to 500 bytes for the SiLab interface).  even a basic UART chip can buffer 15 char at a time.

I'm willing to bet the reason you see 3 lines in your memo is that you read and wrote 3 blocks in you loop. 

You will find the screen updates are where most of your CPU time is going.  I ended up using a thread to get the data from the driver (block by block), checking the new data for header info so I know where the end is, and then passing the completed packet on to the main app for display and decoding.  I used Synapse for my comm interface which works quite well for me and provides me with yet another buffer so I don't loss any bytes.  My throughput is grater than 80K bytes/second.

Offcourse I know the comparison between the microcontroller and PC isn't fair. It was just was comic note.
Using blockread and a seperate thread is a good solid solution. I'm going to look in to that.


[0] Message Index

[*] Previous page

Go to full version