EmbeddedRelated.com
Forums

Serial port throughput

Started by linnix September 30, 2011
I am pumping data from PIC24/Max3232 to PC at 115000 baud.  It works
in burst of 4K blocks.  However, after 10K to 30K of data, the
transmitter shutdown momentally.  The serial link is still up.  I can
issue a micro reset from the serial link, which is the fastest way to
restart the transmission.  The average throughput is around 15000 bps
(bits), including the shutdown/reset cycle.  Without the reset cycle,
i can probably get up to 25000 bps.

I am not sure if this is a logic (PIC24) or signal (Max3232) problem.
My guess is that the transmitter is overwhelming the Max3232 charge
pump, which is running at 5V with 10uF cap on VCC and 1uF cap charge
storages.  Would increasing caps help?
On 30 Sep., 18:56, linnix <m...@linnix.info-for.us> wrote:
> I am pumping data from PIC24/Max3232 to PC at 115000 baud. =A0It works > in burst of 4K blocks. =A0However, after 10K to 30K of data, the > transmitter shutdown momentally. =A0The serial link is still up. =A0I can > issue a micro reset from the serial link, which is the fastest way to > restart the transmission. =A0The average throughput is around 15000 bps > (bits), including the shutdown/reset cycle. =A0Without the reset cycle, > i can probably get up to 25000 bps. > > I am not sure if this is a logic (PIC24) or signal (Max3232) problem. > My guess is that the transmitter is overwhelming the Max3232 charge > pump, which is running at 5V with 10uF cap on VCC and 1uF cap charge > storages. =A0Would increasing caps help?
sound unlikely, the part is rated for 120kbps with 0.1uf caps you probably have a bug in the code have you checked the signal on the pic side of the max3232 with a scope?, or maybe just by toggle an led for every byte/block sent? -Lasse
On Sep 30, 6:56=A0pm, linnix <m...@linnix.info-for.us> wrote:
> I am pumping data from PIC24/Max3232 to PC at 115000 baud. =A0It works > in burst of 4K blocks. =A0However, after 10K to 30K of data, the > transmitter shutdown momentally. =A0The serial link is still up. =A0I can > issue a micro reset from the serial link, which is the fastest way to > restart the transmission. =A0The average throughput is around 15000 bps > (bits), including the shutdown/reset cycle. =A0Without the reset cycle, > i can probably get up to 25000 bps. > > I am not sure if this is a logic (PIC24) or signal (Max3232) problem. > My guess is that the transmitter is overwhelming the Max3232 charge > pump, which is running at 5V with 10uF cap on VCC and 1uF cap charge > storages. =A0Would increasing caps help?
I presume you're using a circular buffer - putch or suchlike to insert characters and the interrupt extracts them. Do you have BufOp (the interrupt output pointer) declared as volatile? Check that every time you add a character to the buffer that you enable the TX interrupt and that you ONLY extract characters in the interrupt routine and don't try and output a character directly if the UART is currently not busy. You should be getting throughtput of closer to 90kbps.
On Sep 30, 10:46=A0am, Rocky <robertg...@gmail.com> wrote:
> On Sep 30, 6:56=A0pm, linnix <m...@linnix.info-for.us> wrote: > > > I am pumping data from PIC24/Max3232 to PC at 115000 baud. =A0It works > > in burst of 4K blocks. =A0However, after 10K to 30K of data, the > > transmitter shutdown momentally. =A0The serial link is still up. =A0I c=
an
> > issue a micro reset from the serial link, which is the fastest way to > > restart the transmission. =A0The average throughput is around 15000 bps > > (bits), including the shutdown/reset cycle. =A0Without the reset cycle, > > i can probably get up to 25000 bps. > > > I am not sure if this is a logic (PIC24) or signal (Max3232) problem. > > My guess is that the transmitter is overwhelming the Max3232 charge > > pump, which is running at 5V with 10uF cap on VCC and 1uF cap charge > > storages. =A0Would increasing caps help? > > I presume you're using a circular buffer - putch or suchlike to insert > characters and the interrupt extracts them. > > Do you have BufOp (the interrupt output pointer) declared as volatile? > Check that every time you add a character to the buffer that you > enable the TX interrupt and that you ONLY extract characters in the > interrupt routine and don't try and output a character directly if the > UART is currently not busy. You should be getting throughtput of > closer to 90kbps.
It's not interrupt driven. Actually, i am using the Microchip sample code to slow down the port: U1TXREG =3D ch; Nop(); while(U1STAbits.TRMT =3D=3D 0); If I want to speed it up, i would use: while(U1STAbits.TRMT =3D=3D 0); U1TXREG =3D ch; But i have to fix the shutdown problem first.
On a sunny day (Fri, 30 Sep 2011 09:56:36 -0700 (PDT)) it happened linnix
<me@linnix.info-for.us> wrote in
<4c7c2a31-cd32-4e5e-9dd6-02928e757480@x19g2000vbl.googlegroups.com>:

>I am pumping data from PIC24/Max3232 to PC at 115000 baud.
First it is 115200 Bd
> It works >in burst of 4K blocks.
Maybe with the wrong baudrate you get framing errors on the Rx side.
> However, after 10K to 30K of data, the >transmitter shutdown momentally. The serial link is still up. I can >issue a micro reset from the serial link, which is the fastest way to >restart the transmission. The average throughput is around 15000 bps >(bits), including the shutdown/reset cycle. Without the reset cycle, >i can probably get up to 25000 bps. > >I am not sure if this is a logic (PIC24) or signal (Max3232) problem. >My guess is that the transmitter is overwhelming the Max3232 charge >pump, which is running at 5V with 10uF cap on VCC and 1uF cap charge >storages. Would increasing caps help?
Scope PIC output, and scope Max output. That should tell you if the signal dies in the MAX. Line capacitance to ground (shield?) is very important too at those speeds. Make sure you have nice rectangular blocks there. You could try 2 stop bits and not 1 to give the receiver some more timn. Are you checking the tx register for empty before sending the next byte? Is any funny interrupt in your system crashing or altering the UART configuration? etc etc etc. Measure do not guess.
On Sep 30, 11:37=A0am, Jan Panteltje <pNaonStpealm...@yahoo.com> wrote:
> On a sunny day (Fri, 30 Sep 2011 09:56:36 -0700 (PDT)) it happened linnix > <m...@linnix.info-for.us> wrote in > <4c7c2a31-cd32-4e5e-9dd6-02928e757...@x19g2000vbl.googlegroups.com>: > > >I am pumping data from PIC24/Max3232 to PC at 115000 baud. > > First it is 115200 Bd
Yes, it's 115200. I just didn't bother to mension the 200.
> Scope PIC output, and scope Max output. > That should tell you if the signal dies in the MAX.
If i can borrow a scope, i haven't use one for a while. Anyway, i'll try to verify the logic some other way: LED, other ports.
> > Line capacitance to ground (shield?) is very important too at those speed=
s.
> Make sure you have nice rectangular blocks there. > > You could try 2 stop bits and not 1 to give the receiver some more timn.
But the PC is more than capable of receiving over 115200.
> Are you checking the tx register for empty before sending the next byte?
Yes, see previous post.
> Is any funny interrupt in your system crashing or altering the UART confi=
guration? USB host stack is running in interrupt, but it should not be touching the UART.
> etc etc etc. > Measure do not guess.

linnix wrote:

> I am pumping data from PIC24/Max3232 to PC at 115000 baud. It works > in burst of 4K blocks. However, after 10K to 30K of data, the > transmitter shutdown momentally. > I am not sure if this is a logic (PIC24) or signal (Max3232) problem.
Apparently a software bug or a protocol lockup. The 115200 baud is no problem neither for PIC nor for MAX3232. VLV
On 2011-09-30, linnix <me@linnix.info-for.us> wrote:
> I am pumping data from PIC24/Max3232 to PC at 115000 baud. It works > in burst of 4K blocks. However, after 10K to 30K of data, the > transmitter shutdown momentally. The serial link is still up. I can > issue a micro reset from the serial link, which is the fastest way to > restart the transmission. The average throughput is around 15000 bps > (bits), including the shutdown/reset cycle. Without the reset cycle, > i can probably get up to 25000 bps. >
What are you doing about flow control ? I've just quickly read the UART section of the PIC24F manual (it's not a part I've ever used before) and I see the PIC24F UART logic can stop transmission if the peer has raised CTS. Is this your problem ? Simon. -- Simon Clubley, clubley@remove_me.eisner.decus.org-Earth.UFP Microsoft: Bringing you 1980s technology to a 21st century world
"linnix" <me@linnix.info-for.us> wrote in message 
news:4c7c2a31-cd32-4e5e-9dd6-02928e757480@x19g2000vbl.googlegroups.com...
>I am pumping data from PIC24/Max3232 to PC at 115000 baud. It works > in burst of 4K blocks. However, after 10K to 30K of data, the > transmitter shutdown momentally. The serial link is still up. I can > issue a micro reset from the serial link, which is the fastest way to > restart the transmission. The average throughput is around 15000 bps > (bits), including the shutdown/reset cycle. Without the reset cycle, > i can probably get up to 25000 bps. > > I am not sure if this is a logic (PIC24) or signal (Max3232) problem. > My guess is that the transmitter is overwhelming the Max3232 charge > pump, which is running at 5V with 10uF cap on VCC and 1uF cap charge > storages. Would increasing caps help?
I have come across non Maxim 232 parts that fall over at 115200 baud.... I think you need a scope on it or some debug equipment....
linnix wrote:
> I am pumping data from PIC24/Max3232 to PC at 115000 baud. It works > in burst of 4K blocks. However, after 10K to 30K of data, the > transmitter shutdown momentally.
Then the transmitter has shut down. That's the circuit on the PIC24/Max232 side. It might even be the UART. Try varying: - the baud rate - insert delays on the transmit side every block. - only allow the xmit FIFO to get so full. and see if one or more strategies makes the stoppage go away. I don't have the device in front of me, but a Max232 (not a 3232 - haven't used those yet ) should merrily twiddle the transmit pin without being connected, so ... I'd also check to see if there's a problem with the baud clock generator on the embedded side. Sometimes the divisor gets small for 115,200 and you'll get latch-ey behavior. This is very hand-wavey, so...
> The serial link is still up.
What does that mean? DCD or something?
> I can > issue a micro reset from the serial link, which is the fastest way to > restart the transmission. The average throughput is around 15000 bps > (bits), including the shutdown/reset cycle. Without the reset cycle, > i can probably get up to 25000 bps. >
This sounds like you can back off the baud rate if you need to then.
> I am not sure if this is a logic (PIC24) or signal (Max3232) problem. > My guess is that the transmitter is overwhelming the Max3232 charge > pump, which is running at 5V with 10uF cap on VCC and 1uF cap charge > storages. Would increasing caps help?
Scope it. There should be a pin you can watch on the Max3232 to indicate that it's transmitting; put that and the cap. charge on a scope and see if the cap charge voltage goes out. I would think that if is were a cap. discharge failure mode that it would be more periodic, but that's not necessarily so. The data pattern may influence duty cycle. So I'd repeat exactly the same data pattern for every 4k block and see if the shutdown time gets more constant. Make sure you have good signal ground connections, too. -- Les Cargill