EmbeddedRelated.com
Forums

Serial port throughput

Started by linnix September 30, 2011
On Oct 1, 5:27=A0pm, linnix <m...@linnix.info-for.us> wrote:
> On Sep 30, 11:32=A0pm, Rocky <robertg...@gmail.com> wrote: > > > > > > > On Sep 30, 7:59=A0pm, linnix <m...@linnix.info-for.us> wrote: > > > > 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 can
> > > > > issue a micro reset from the serial link, which is the fastest wa=
y to
> > > > > restart the transmission. =A0The average throughput is around 150=
00 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) prob=
lem.
> > > > > My guess is that the transmitter is overwhelming the Max3232 char=
ge
> > > > > pump, which is running at 5V with 10uF cap on VCC and 1uF cap cha=
rge
> > > > > storages. =A0Would increasing caps help? > > > > > I presume you're using a circular buffer - putch or suchlike to ins=
ert
> > > > characters and the interrupt extracts them. > > > > > Do you have BufOp (the interrupt output pointer) declared as volati=
le?
> > > > 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. =A0Actually, i am using the Microchip samp=
le
> > > code to slow down the port: > > > > =A0 =A0 U1TXREG =3D ch; > > > =A0 =A0 Nop(); > > > =A0 =A0 while(U1STAbits.TRMT =3D=3D 0); > > > Which particular PIC24? > > PIC24FJ256DA206 >
To which pins do you have the UART mapped? Did you lock the IO after mapping?
In article <4bc92b5f-9485-4594-8f46-527f42b62913@
20g2000yqq.googlegroups.com>, me@linnix.info-for.us says...

> Microchip assembler codes are very difficult to read, but here it is:
If you get rid of all the junk put in there by the compiler for its own housekeeping, the actual assembly isn't all that difficult to understand. I'm not entirely clear on the relationship between WREG and w0 in the two lines after .L38: That is due to my ignorance of the architecture of this particular PIC chip. On other chips, I would guess that the code is loading into one register, then checking another. But then it is possible that one of those deleted directives is telling us that WREG is really wO. It looks like the character to be sent arrives in w0
> _UART1PutChar: > mov.b w0,w1 > .L38: > mov.b _U1STAbits+1,WREG > btst w0,#1 > bra nz,.L38 > se w1,w0 > mov w0,_U1TXREG > mov #400,w0 > .L40: > nop > dec w0,w0 > bra nz,.L40 > return
The remaining questions are: is bit #1 of the register at _U1STAbits+1 the proper bit to be testing? You should verify this with the data sheet. Is that bit 1 when there is still data being transmitted? It doesn't look like the register loads are being skipped--- something that you can see if the registers aren't defined properly as volatile. Mark Borgerson
On Oct 6, 9:46=A0am, Rocky <robertg...@gmail.com> wrote:
> On Oct 1, 5:27=A0pm, linnix <m...@linnix.info-for.us> wrote: > > > > > On Sep 30, 11:32=A0pm, Rocky <robertg...@gmail.com> wrote: > > > > On Sep 30, 7:59=A0pm, linnix <m...@linnix.info-for.us> wrote: > > > > > 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. =A0I=
t works
> > > > > > in burst of 4K blocks. =A0However, after 10K to 30K of data, th=
e
> > > > > > 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 1=
5000 bps
> > > > > > (bits), including the shutdown/reset cycle. =A0Without the rese=
t cycle,
> > > > > > i can probably get up to 25000 bps. > > > > > > > I am not sure if this is a logic (PIC24) or signal (Max3232) pr=
oblem.
> > > > > > My guess is that the transmitter is overwhelming the Max3232 ch=
arge
> > > > > > pump, which is running at 5V with 10uF cap on VCC and 1uF cap c=
harge
> > > > > > storages. =A0Would increasing caps help? > > > > > > I presume you're using a circular buffer - putch or suchlike to i=
nsert
> > > > > characters and the interrupt extracts them. > > > > > > Do you have BufOp (the interrupt output pointer) declared as vola=
tile?
> > > > > Check that every time you add a character to the buffer that you > > > > > enable the TX interrupt and that you ONLY extract characters in t=
he
> > > > > interrupt routine and don't try and output a character directly i=
f the
> > > > > UART is currently not busy. You should be getting throughtput of > > > > > closer to 90kbps. > > > > > It's not interrupt driven. =A0Actually, i am using the Microchip sa=
mple
> > > > code to slow down the port: > > > > > =A0 =A0 U1TXREG =3D ch; > > > > =A0 =A0 Nop(); > > > > =A0 =A0 while(U1STAbits.TRMT =3D=3D 0); > > > > Which particular PIC24? > > > PIC24FJ256DA206 > > To which pins do you have the UART mapped? Did you lock the IO after > mapping?-
RP26 for RX and RP10 for TX.
On Oct 6, 2:45=A0pm, Mark Borgerson <mborger...@comcast.net> wrote:
> In article <4bc92b5f-9485-4594-8f46-527f42b62913@ > 20g2000yqq.googlegroups.com>, m...@linnix.info-for.us says... > > > Microchip assembler codes are very difficult to read, but here it is: > > If you get rid of all the junk put in there by the compiler for > its own housekeeping, the actual assembly isn't all that > difficult to understand. =A0I'm not entirely clear on the > relationship between WREG and w0 in the two lines > after .L38: =A0 =A0That is due to my ignorance of the > architecture of this particular PIC chip. =A0 On other > chips, I would guess that the code is loading into > one register, then checking another. =A0But then it is > possible that one of those deleted directives is > telling us that WREG is really wO. > > It looks like the character to be sent arrives in w0 > > > _UART1PutChar: > > =A0 =A0mov.b =A0 w0,w1 > > .L38: > > =A0 =A0mov.b =A0 _U1STAbits+1,WREG > > =A0 =A0btst =A0 =A0w0,#1 > > =A0 =A0bra =A0 =A0 nz,.L38 > > =A0 =A0se =A0 =A0 =A0w1,w0 > > =A0 =A0mov =A0 =A0 w0,_U1TXREG > > =A0 =A0mov =A0 =A0 #400,w0 > > .L40: > > =A0 =A0nop > > =A0 =A0dec =A0 =A0 w0,w0 > > =A0 =A0bra =A0 =A0 nz,.L40 > > =A0 =A0return > > The remaining questions are: > > is bit #1 =A0of the register at =A0_U1STAbits+1 =A0the proper bit > to be testing? =A0You should verify this with the data sheet.
Bit 9 of U1StA or bit 1 of U1STA+1. It is the transmitter buffer empty flag when 0.
On Oct 6, 3:06=A0pm, linnix <m...@linnix.info-for.us> wrote:
> On Oct 6, 2:45=A0pm, Mark Borgerson <mborger...@comcast.net> wrote: > > > > > > > In article <4bc92b5f-9485-4594-8f46-527f42b62913@ > > 20g2000yqq.googlegroups.com>, m...@linnix.info-for.us says... > > > > Microchip assembler codes are very difficult to read, but here it is: > > > If you get rid of all the junk put in there by the compiler for > > its own housekeeping, the actual assembly isn't all that > > difficult to understand. =A0I'm not entirely clear on the > > relationship between WREG and w0 in the two lines > > after .L38: =A0 =A0That is due to my ignorance of the > > architecture of this particular PIC chip. =A0 On other > > chips, I would guess that the code is loading into > > one register, then checking another. =A0But then it is > > possible that one of those deleted directives is > > telling us that WREG is really wO. > > > It looks like the character to be sent arrives in w0 > > > > _UART1PutChar: > > > =A0 =A0mov.b =A0 w0,w1 > > > .L38: > > > =A0 =A0mov.b =A0 _U1STAbits+1,WREG > > > =A0 =A0btst =A0 =A0w0,#1 > > > =A0 =A0bra =A0 =A0 nz,.L38 > > > =A0 =A0se =A0 =A0 =A0w1,w0 > > > =A0 =A0mov =A0 =A0 w0,_U1TXREG > > > =A0 =A0mov =A0 =A0 #400,w0 > > > .L40: > > > =A0 =A0nop > > > =A0 =A0dec =A0 =A0 w0,w0 > > > =A0 =A0bra =A0 =A0 nz,.L40 > > > =A0 =A0return > > > The remaining questions are: > > > is bit #1 =A0of the register at =A0_U1STAbits+1 =A0the proper bit > > to be testing? =A0You should verify this with the data sheet. > > Bit 9 of U1StA or bit 1 of U1STA+1. =A0It is the transmitter buffer > empty flag when 0
Just got some TI max232. Running without delay now. while(U1STAbits.UTXBF !=3D 0); U1TXREG =3D ch; I have to conclude that TI max3232 does not meet the spec. Thank everyone for responding to this issue.