ARMStamp RXD issue

Questions on UARTs, and serial communication
olzeke51
Posts: 414
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

ARMStamp RXD issue

Post by olzeke51 »

First off - some of this is unorthodox procedure !!
Attempting to create a Serial Comm link with the ARMstamp - I tested the ability to TXD first. -- Works,but
did notice some "funnies" - a different Forum post.
'
Did not connect the RXD line - (so it is floating?)- but later on did a RXD test and got the "garbage"
as can be seen in the "Debug Variable portion of the picture" - code snippet/function was copied from
one of your forum links re: serial. called 'getline' - [OEM current testing via SPI devices]
'
connected RXD to the Coridium Dongle and I get nothing - not even 'garbage'/CR/LF- from TclTerm which is
connected to the Dongle
'
tested on ARMstamp Production and Beta unit - both fail ::: SuperPro works fine on BAUD(0) & TclTerm & Dongle
'
Could you verify RXD works at 19200 baud on the ARMStamp ???
Olzeke
P.S. a picture is worth ......
Attachments
RXD.jpg
RXD.jpg (134.16 KiB) Viewed 19519 times



basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: ARMStamp RXD issue

Post by basicchip »

RXD1 and TXD1 use to be handled by a dedicated firmware routine that no longer exists, hence the error

Yes the Help file should be fixed (a never ending process, but thanks)

On the ARMstamp, the serial channel 0 is routed through the USB which is quite different than the serial hardware. Baudrates don't matter there as the Windows USB serrial driver ignores them. TXfree also always shows totally free, as buffers are passed to the USB code in the ARM

If you have old code using RXD1 and TXD1, a good workaround would be

#define RXD1 RXD(1)
#define TXD1 TXD(1)

If any RXD(x) input is floated, you get whatever. If you want it to show idle, you need a pullup.

TXD(1) working for me (ARMstamp -> USB dongle)

Code: Select all

baud(1)=19200
for i=1 to 20
txd(1)=&H40 + i
next

olzeke51
Posts: 414
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

Re: ARMStamp RXD issue

Post by olzeke51 »

The TXD situation was workable.
'
the main issue was the RXD(1)- actual data getting in.
it is interesting that the floating input , would actually capture the TXD data - for a short while !!
[see the COMMAND data display - that was the RXD(1) data whhile the input was floating !!]
'
can you test the RXD(1) function ????
Thanks - gz

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: ARMStamp RXD issue

Post by basicchip »

Any floating input can generate any kind of data -- not very surprising.

And this working for me

Code: Select all

' this assumes a connection between RXD(1), TXD(1) and some other serial device using TclTerm, TeraTerm...  
' tested with a USB dongle and ARMstamp

main:

baud(1)=19200
for i=1 to 20
txd(1)=&H40 + i
next

ch= rxd(1)
while ch<>"X"
  ch = rxd(1)
  if ch>0 then print chr(ch);
loop
serialCHK.jpg
serialCHK.jpg (43.88 KiB) Viewed 19513 times

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: ARMStamp RXD issue

Post by basicchip »

PS you should hook up GND as well as TXD and RXD lines

olzeke51
Posts: 414
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

Re: ARMStamp RXD issue

Post by olzeke51 »

Hello Y'all,
I have egg on most of my face. You need to know your tools & apps!!
Basicchip was VERY patient and helpful. He put in 2+ hours one afternoon,
and then 3 more late night/early morning posts (off channel). Drug out
his hardware and did testing, even created some little routines -

[might be a blog item !?!?!?].
'
The main issue was receiving data from the TclTerm.exe (Tterm) program;
that comes with the Coridium Basic install - its in the root folder.
Turns out that with Windows being multi-windowing with many open apps,
some of them get shifted around so you can see different app-statuses.
This was my case - Tterm was shifted down so that I only saw the
terminal(or received data) portion. When you select Tterm to have the
focus of the keyboard and click on that terminal/data portion (to select
Tterm as the focus)- that is where the cursor ends up blinking.
'
As an old-timer - a 'terminal' device with a blinking cursor means that
it is waiting for you to enter data....AND that is what I did -but had
no results. I even loaded up a 2nd computer with Tterm - same results!
Nada, zero, nothing, blank screen....
'
Turns out - Tterm has a single-line "ENTER" window down at the bottom!!
and that is where the blinking cursor needs to be to 'Enter keyboard data'!!
Note: if you 'cursor/mouse' there before you switch to another app; then if
you click the Tterm title bar to select it - your 'ENTER' window will still
have the focus and you can start keyboarding. This was an additional 2 hours
of my time today.....
'
Know your tools - Olzeke
BAUD_test.bas
(744 Bytes) Downloaded 547 times
'
******* 11u37 serial info, and two 'funnies' discovered ****

TXD(0) will output to the USB connector
TXD(1) outputs to the onboard USART-SOUT pin
'
RXD(1) inputs received data from SIN pin
'
BAUD(0) OR BAUD(1) will program the USART baud rate !!!
see BAUD_test.bas
'
TXFREE(0) will report the status of the USART buffer of TXD(1)
TXFREE(1) [or any other number] reports a -1

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: ARMStamp RXD issue

Post by basicchip »

TXD(0) will output to the USB connector
TXD(1) outputs to the onboard USART-SOUT pin
'
RXD(1) inputs received data from SIN pin
'
Both those expected, as while we have UART0, and the debug port which has always been RXD(0) and TXD(0) on all other parts.

So what to do???

well we intentionally send TXD(1)/RXD(1) to UART0

So I guess we'll look at BAUD(0) affecting UART, it should not, but BAUD is actually ignored on USB driver, so it really never would get used

But we will look at TXFREE for UART, as it also has no meaning for on chip USB serial devices

olzeke51
Posts: 414
Joined: Sat May 17, 2014 4:22 pm
Location: South Carolina

Re: ARMStamp RXD issue

Post by olzeke51 »

My main goal was to document the work-arounds/ awareness. If/when the
kernel needs/gets updated - it could be incorporated at that time.
'
But to do it specifically for those two minor situations - might not be a good ROI.
Thanks for the consideration, though.
Gary

UART0 is not a BASIC keyword so .... kind of a grey area - my 2 cents - gz

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: ARMStamp RXD issue

Post by basicchip »

TXFREE works for me. EDIT -- on a newer firmware version.

Not sure it is worth addressing BAUD(0)/BAUD(1) interaction on Stamp, as BAUD(0) would really never get used there. Here is my test code--

Code: Select all

main:

baud(1)=115200

free0i = txfree(0)
free1i = txfree(1)

TXD(0) = 0x41
TXD(0) = 0x42
TXD(0) = 0x43
TXD(0) = 0x44
TXD(0) = 10
free0 = txfree(0)
TXD(1) = 0x45
TXD(1) = 0x46
TXD(1) = 0x47
TXD(1) = 0x48
TXD(1) = 10
free1 = txfree(1)
printf("free %d %d %d",free0i,free1i,txfree(2))
printf("free %d %d %d",free0,free1,txfree(2))
txfree.jpg
txfree.jpg (92.53 KiB) Viewed 19478 times

basicchip
Posts: 1090
Joined: Fri Oct 19, 2012 2:39 am
Location: Weeki Watchee, FL
Contact:

Re: ARMStamp RXD issue

Post by basicchip »

In the current release of firmware 8.40b, txfree is broken on the LPC11U37, the ARMstamp

If you really need this function, contact me and I will send a corrected firmware.

Post Reply