Discussion forum for the BasicX family of microcontroller chips.
problems with com1 on bx-35 - Edward Ringel - Apr 10 22:05:21 2006
I am trying to have the BX-35 development board communicate with a
piece of hardware, a DSP board, via the serial port com1. I have
been unable to get the DSP board to receive commands from the BX-35.
I have connected the RS232 interface on the development board with
the RS232 interface on the DSP board. To start with, I want to send
a simple 3 character command, $BF. I KNOW that the DSP board works,
because if I send it that command from my PC, it works just fine.
In an effort to figure this out a little better, I put together this
very small piece of code:
Option Explicit
Dim Icom1(1 to 20) as Byte
Dim Ocom1(1 to 20) as Byte
dim msg(1 to 3) as Byte
Sub Main()
Call OpenQueue(Icom1,20)
Call OpenQueue(OCom1,20)
Call ClearQueue(OCom1)
Call ClearQueue(ICom1)
Call OpenCom(1,9600,Icom1,Ocom1)
msg(1) = cbyte(asc("$"))
msg(2) = cbyte(asc("B"))
msg(3) = cbyte(asc("F"))
Call PutQueue(OCom1, msg(1),1)
Call PutQueue(OCom1, msg(2),1)
Call PutQueue(OCom1, msg(3),1)
Call CloseCom(1, ICom1, OCom1)
end sub
The results of this are very interesting. Leaving the development
board hooked up to the computer, I get 4 characters of gibberish. If
I recompile with OpenCom at 19200 baud, I get "$B", just 2
characters. If I slow down the communication rate to 300, I get 6
characters of gibberish. If I replace all of the above with a
simple debug.print "$BF", everything is fine.
I don't understand this. It feels like the compiler or the processor
has set up its own queue for this hardware UART that is in conflict
with my queues and com port. Can anyone explain this and offer a
workaround? My DSP board will only accept communication at 9600, and
Com3 is tied up talking to the LCD+.
Thanks.

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
Re: problems with com1 on bx-35 - Chris - Apr 11 14:11:45 2006
Can you connect the DSP board directly to the PC and use HyperTerminal to
send those commands?
This would tell us if your boards serial port is inverted or not. Next are
you using a null modem cable?
You don't need to use ClearQueue, the Queues are cleared when openqueue is
called. Also, you may be
closing the serial port before all the data has left the Queue. Here is a
smaller version of your program
that may help.
Dim Icom1(1 to 20) as Byte
Dim Ocom1(1 to 20) as Byte
Sub Main()
Call OpenQueue(Icom1,20)
Call OpenQueue(OCom1,20)
Call OpenCom(1,9600,Icom1,Ocom1)
Call Sleep(20)
Call PutQueueStr(OCom1, Chr(36) & Chr(66) & Chr(70) )
Do
Loop
End sub
Chris
----- Original Message -----
From: "Edward Ringel"
To:
Sent: Monday, April 10, 2006 7:00 PM
Subject: [BasicX] problems with com1 on bx-35
>I am trying to have the BX-35 development board communicate with a
> piece of hardware, a DSP board, via the serial port com1. I have
> been unable to get the DSP board to receive commands from the BX-35.
> I have connected the RS232 interface on the development board with
> the RS232 interface on the DSP board. To start with, I want to send
> a simple 3 character command, $BF. I KNOW that the DSP board works,
> because if I send it that command from my PC, it works just fine.
>
> In an effort to figure this out a little better, I put together this
> very small piece of code:
>
> Option Explicit
> Dim Icom1(1 to 20) as Byte
> Dim Ocom1(1 to 20) as Byte
> dim msg(1 to 3) as Byte
>
> Sub Main()
> Call OpenQueue(Icom1,20)
> Call OpenQueue(OCom1,20)
> Call ClearQueue(OCom1)
> Call ClearQueue(ICom1)
> Call OpenCom(1,9600,Icom1,Ocom1)
> msg(1) = cbyte(asc("$"))
> msg(2) = cbyte(asc("B"))
> msg(3) = cbyte(asc("F"))
> Call PutQueue(OCom1, msg(1),1)
> Call PutQueue(OCom1, msg(2),1)
> Call PutQueue(OCom1, msg(3),1)
> Call CloseCom(1, ICom1, OCom1)
> end sub
>
> The results of this are very interesting. Leaving the development
> board hooked up to the computer, I get 4 characters of gibberish. If
> I recompile with OpenCom at 19200 baud, I get "$B", just 2
> characters. If I slow down the communication rate to 300, I get 6
> characters of gibberish. If I replace all of the above with a
> simple debug.print "$BF", everything is fine.
>
> I don't understand this. It feels like the compiler or the processor
> has set up its own queue for this hardware UART that is in conflict
> with my queues and com port. Can anyone explain this and offer a
> workaround? My DSP board will only accept communication at 9600, and
> Com3 is tied up talking to the LCD+.
>
> Thanks.

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )Re: problems with com1 on bx-35 - Edward Ringel - Apr 11 15:16:55 2006
I am using TeraTerm to send the commands from the PC as the contents of a file. The DSP
board has an odd configuration and needs the three characters sent as a burst otherwise
it
misinterprets. I am however, able to send from the PC.
I will try your code when I get back home and see if that improves things by putting in
the
pauses. I will post when I know the results.
Thanks very much.
Ed
--- In b...@yahoogroups.com, "Chris"
wrote:
>
> Can you connect the DSP board directly to the PC and use HyperTerminal to
> send those commands?
> This would tell us if your boards serial port is inverted or not. Next are
> you using a null modem cable?
> You don't need to use ClearQueue, the Queues are cleared when openqueue is
> called. Also, you may be
> closing the serial port before all the data has left the Queue. Here is a
> smaller version of your program
> that may help.
>
> Dim Icom1(1 to 20) as Byte
> Dim Ocom1(1 to 20) as Byte
>
> Sub Main()
> Call OpenQueue(Icom1,20)
> Call OpenQueue(OCom1,20)
> Call OpenCom(1,9600,Icom1,Ocom1)
> Call Sleep(20)
> Call PutQueueStr(OCom1, Chr(36) & Chr(66) & Chr(70) )
>
> Do
>
> Loop
>
> End sub
>
> Chris
> ----- Original Message -----
> From: "Edward Ringel"
> To:
> Sent: Monday, April 10, 2006 7:00 PM
> Subject: [BasicX] problems with com1 on bx-35
> >I am trying to have the BX-35 development board communicate with a
> > piece of hardware, a DSP board, via the serial port com1. I have
> > been unable to get the DSP board to receive commands from the BX-35.
> > I have connected the RS232 interface on the development board with
> > the RS232 interface on the DSP board. To start with, I want to send
> > a simple 3 character command, $BF. I KNOW that the DSP board works,
> > because if I send it that command from my PC, it works just fine.
> >
> > In an effort to figure this out a little better, I put together this
> > very small piece of code:
> >
> > Option Explicit
> > Dim Icom1(1 to 20) as Byte
> > Dim Ocom1(1 to 20) as Byte
> > dim msg(1 to 3) as Byte
> >
> > Sub Main()
> > Call OpenQueue(Icom1,20)
> > Call OpenQueue(OCom1,20)
> > Call ClearQueue(OCom1)
> > Call ClearQueue(ICom1)
> > Call OpenCom(1,9600,Icom1,Ocom1)
> > msg(1) = cbyte(asc("$"))
> > msg(2) = cbyte(asc("B"))
> > msg(3) = cbyte(asc("F"))
> > Call PutQueue(OCom1, msg(1),1)
> > Call PutQueue(OCom1, msg(2),1)
> > Call PutQueue(OCom1, msg(3),1)
> > Call CloseCom(1, ICom1, OCom1)
> > end sub
> >
> > The results of this are very interesting. Leaving the development
> > board hooked up to the computer, I get 4 characters of gibberish. If
> > I recompile with OpenCom at 19200 baud, I get "$B", just 2
> > characters. If I slow down the communication rate to 300, I get 6
> > characters of gibberish. If I replace all of the above with a
> > simple debug.print "$BF", everything is fine.
> >
> > I don't understand this. It feels like the compiler or the processor
> > has set up its own queue for this hardware UART that is in conflict
> > with my queues and com port. Can anyone explain this and offer a
> > workaround? My DSP board will only accept communication at 9600, and
> > Com3 is tied up talking to the LCD+.
> >
> > Thanks.
> >
> >
> >
> >
> >
> >
> >
> >

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )Re: problems with com1 on bx-35 - Edward Ringel - Apr 11 20:08:40 2006
I looked into this some more and ran the DSP board from COM3 using
the code provided below. Still didn't work, so I tried using
inverted logic--success!!
Now the question is this-- can I run the LCD+ from the COM1 port, or
is it easier to close the LCD+ port, re-define COM3 on a different
set of pins connected to the DSP board, send the command, and then
use the LCD+ routines again? Other possibilities-- a) can I set
COM1 to inverted logic or 2) tack on an outboard inverter gate?
Thanks.
Ed
--- In b...@yahoogroups.com, "Edward Ringel"
wrote:
>
> I am using TeraTerm to send the commands from the PC as the
contents of a file. The DSP
> board has an odd configuration and needs the three characters sent
as a burst otherwise it
> misinterprets. I am however, able to send from the PC.
>
> I will try your code when I get back home and see if that improves
things by putting in the
> pauses. I will post when I know the results.
>
> Thanks very much.
>
> Ed
>
> --- In b...@yahoogroups.com, "Chris" wrote:
> >
> > Can you connect the DSP board directly to the PC and use
HyperTerminal to
> > send those commands?
> > This would tell us if your boards serial port is inverted or
not. Next are
> > you using a null modem cable?
> > You don't need to use ClearQueue, the Queues are cleared when
openqueue is
> > called. Also, you may be
> > closing the serial port before all the data has left the Queue.
Here is a
> > smaller version of your program
> > that may help.
> >
> > Dim Icom1(1 to 20) as Byte
> > Dim Ocom1(1 to 20) as Byte
> >
> > Sub Main()
> > Call OpenQueue(Icom1,20)
> > Call OpenQueue(OCom1,20)
> > Call OpenCom(1,9600,Icom1,Ocom1)
> > Call Sleep(20)
> > Call PutQueueStr(OCom1, Chr(36) & Chr(66) & Chr(70) )
> >
> > Do
> >
> > Loop
> >
> > End sub
> >
> >
> >
> > Chris
> >
> >
> > ----- Original Message -----
> > From: "Edward Ringel"
> > To:
> > Sent: Monday, April 10, 2006 7:00 PM
> > Subject: [BasicX] problems with com1 on bx-35
> >
> >
> > >I am trying to have the BX-35 development board communicate
with a
> > > piece of hardware, a DSP board, via the serial port com1. I
have
> > > been unable to get the DSP board to receive commands from the
BX-35.
> > > I have connected the RS232 interface on the development board
with
> > > the RS232 interface on the DSP board. To start with, I want to
send
> > > a simple 3 character command, $BF. I KNOW that the DSP board
works,
> > > because if I send it that command from my PC, it works just
fine.
> > >
> > > In an effort to figure this out a little better, I put
together this
> > > very small piece of code:
> > >
> > > Option Explicit
> > > Dim Icom1(1 to 20) as Byte
> > > Dim Ocom1(1 to 20) as Byte
> > > dim msg(1 to 3) as Byte
> > >
> > > Sub Main()
> > > Call OpenQueue(Icom1,20)
> > > Call OpenQueue(OCom1,20)
> > > Call ClearQueue(OCom1)
> > > Call ClearQueue(ICom1)
> > > Call OpenCom(1,9600,Icom1,Ocom1)
> > > msg(1) = cbyte(asc("$"))
> > > msg(2) = cbyte(asc("B"))
> > > msg(3) = cbyte(asc("F"))
> > > Call PutQueue(OCom1, msg(1),1)
> > > Call PutQueue(OCom1, msg(2),1)
> > > Call PutQueue(OCom1, msg(3),1)
> > > Call CloseCom(1, ICom1, OCom1)
> > > end sub
> > >
> > > The results of this are very interesting. Leaving the
development
> > > board hooked up to the computer, I get 4 characters of
gibberish. If
> > > I recompile with OpenCom at 19200 baud, I get "$B", just 2
> > > characters. If I slow down the communication rate to 300, I
get 6
> > > characters of gibberish. If I replace all of the above with a
> > > simple debug.print "$BF", everything is fine.
> > >
> > > I don't understand this. It feels like the compiler or the
processor
> > > has set up its own queue for this hardware UART that is in
conflict
> > > with my queues and com port. Can anyone explain this and
offer a
> > > workaround? My DSP board will only accept communication at
9600, and
> > > Com3 is tied up talking to the LCD+.
> > >
> > > Thanks.
> > >
> > >
> > >
> > >
> > >
> > >
> > >
> > >

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )Re: Re: problems with com1 on bx-35 - "ese...@" - Apr 11 20:58:08 2006
Hi Ed,
There is some good serial code for multiple COM ports at:
http://www.phanderson.com/bx24/ser_24.html
Best Regards, Eric
----- Original Message -----
From: Edward Ringel
To: b...@yahoogroups.com
Sent: Tuesday, April 11, 2006 4:50 PM
Subject: [BasicX] Re: problems with com1 on bx-35
I looked into this some more and ran the DSP board from COM3 using
the code provided below. Still didn't work, so I tried using
inverted logic--success!!
Now the question is this-- can I run the LCD+ from the COM1 port, or
is it easier to close the LCD+ port, re-define COM3 on a different
set of pins connected to the DSP board, send the command, and then
use the LCD+ routines again? Other possibilities-- a) can I set
COM1 to inverted logic or 2) tack on an outboard inverter gate?
Thanks.
Ed
[Non-text portions of this message have been removed]

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )
Re: problems with com1 on bx-35 - Edward Ringel - Apr 12 12:53:17 2006
Hi Eric,
Thanks very much for the tip. Looked over the code-- he's doing in a
much more sophisticated way what I had already done, which is to open
com3 send/receive data, and then close com3. Each "port" has its own
pins, and the "port" is only open during a send/receive session. In
that way, you can simulate multiple ports. It actually works quite
well, and is fast. I didn't do all that excellent error checking and
formatting, because my needs are much simpler.
Ed
--- In b...@yahoogroups.com, "eserdahl@"
wrote:
>
> Hi Ed,
>
> There is some good serial code for multiple COM ports at:
> http://www.phanderson.com/bx24/ser_24.html
>
> Best Regards, Eric
> ----- Original Message -----
> From: Edward Ringel
> To: b...@yahoogroups.com
> Sent: Tuesday, April 11, 2006 4:50 PM
> Subject: [BasicX] Re: problems with com1 on bx-35
> I looked into this some more and ran the DSP board from COM3
using
> the code provided below. Still didn't work, so I tried using
> inverted logic--success!!
>
> Now the question is this-- can I run the LCD+ from the COM1 port,
or
> is it easier to close the LCD+ port, re-define COM3 on a
different
> set of pins connected to the DSP board, send the command, and
then
> use the LCD+ routines again? Other possibilities-- a) can I set
> COM1 to inverted logic or 2) tack on an outboard inverter gate?
>
> Thanks.
>
> Ed
>
> [Non-text portions of this message have been removed]
>

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )Re: Re: problems with com1 on bx-35 - Chris - Apr 12 13:55:55 2006
I would just use com1 for the LCD+ and com3 for your DSP device.
Chris
----- Original Message -----
From: "Edward Ringel"
To:
Sent: Wednesday, April 12, 2006 8:52 AM
Subject: [BasicX] Re: problems with com1 on bx-35
> Hi Eric,
>
> Thanks very much for the tip. Looked over the code-- he's doing in a
> much more sophisticated way what I had already done, which is to open
> com3 send/receive data, and then close com3. Each "port" has its own
> pins, and the "port" is only open during a send/receive session. In
> that way, you can simulate multiple ports. It actually works quite
> well, and is fast. I didn't do all that excellent error checking and
> formatting, because my needs are much simpler.
>
> Ed
>
> --- In b...@yahoogroups.com, "eserdahl@" wrote:
>>
>> Hi Ed,
>>
>> There is some good serial code for multiple COM ports at:
>> http://www.phanderson.com/bx24/ser_24.html
>>
>> Best Regards, Eric
>> ----- Original Message -----
>> From: Edward Ringel
>> To: b...@yahoogroups.com
>> Sent: Tuesday, April 11, 2006 4:50 PM
>> Subject: [BasicX] Re: problems with com1 on bx-35
>> I looked into this some more and ran the DSP board from COM3
> using
>> the code provided below. Still didn't work, so I tried using
>> inverted logic--success!!
>>
>> Now the question is this-- can I run the LCD+ from the COM1 port,
> or
>> is it easier to close the LCD+ port, re-define COM3 on a
> different
>> set of pins connected to the DSP board, send the command, and
> then
>> use the LCD+ routines again? Other possibilities-- a) can I set
>> COM1 to inverted logic or 2) tack on an outboard inverter gate?
>>
>> Thanks.
>>
>> Ed
>>
>> [Non-text portions of this message have been removed]
>>

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )Re: problems with com1 on bx-35 - Edward Ringel - Apr 12 18:10:45 2006
I expect that in the end I will do that. I'll have to rewrite some of
the code that comes with the LCD+, but that shouldn't be too hard.
Thanks for your help. Ed
--- In b...@yahoogroups.com, "Chris"
wrote:
>
> I would just use com1 for the LCD+ and com3 for your DSP device.
> Chris
> ----- Original Message -----
> From: "Edward Ringel"
> To:
> Sent: Wednesday, April 12, 2006 8:52 AM
> Subject: [BasicX] Re: problems with com1 on bx-35
> > Hi Eric,
> >
> > Thanks very much for the tip. Looked over the code-- he's doing
in a
> > much more sophisticated way what I had already done, which is to
open
> > com3 send/receive data, and then close com3. Each "port" has its
own
> > pins, and the "port" is only open during a send/receive session.
In
> > that way, you can simulate multiple ports. It actually works
quite
> > well, and is fast. I didn't do all that excellent error checking
and
> > formatting, because my needs are much simpler.
> >
> > Ed
> >
> > --- In b...@yahoogroups.com, "eserdahl@" wrote:
> >>
> >> Hi Ed,
> >>
> >> There is some good serial code for multiple COM ports at:
> >> http://www.phanderson.com/bx24/ser_24.html
> >>
> >> Best Regards, Eric
> >> ----- Original Message -----
> >> From: Edward Ringel
> >> To: b...@yahoogroups.com
> >> Sent: Tuesday, April 11, 2006 4:50 PM
> >> Subject: [BasicX] Re: problems with com1 on bx-35
> >>
> >>
> >> I looked into this some more and ran the DSP board from COM3
> > using
> >> the code provided below. Still didn't work, so I tried using
> >> inverted logic--success!!
> >>
> >> Now the question is this-- can I run the LCD+ from the COM1
port,
> > or
> >> is it easier to close the LCD+ port, re-define COM3 on a
> > different
> >> set of pins connected to the DSP board, send the command, and
> > then
> >> use the LCD+ routines again? Other possibilities-- a) can I
set
> >> COM1 to inverted logic or 2) tack on an outboard inverter gate?
> >>
> >> Thanks.
> >>
> >> Ed
> >>
> >> [Non-text portions of this message have been removed]
> >>
> >
> >
> >
> >
> >
> >
> >
> >

(You need to be a member of basicx -- send a blank email to basicx-subscribe@yahoogroups.com )