BasicMicro - Forums

www.basicmicro.com
It is currently Sat Feb 04, 2012 5:56 pm

All times are UTC - 8 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Another SERIN bug
PostPosted: Thu Feb 25, 2010 9:02 pm 
Offline
Citizen

Joined: Mon Feb 01, 2010 9:40 pm
Posts: 43
I have another issue with SERIN command. In short, it cannot receive a string longer than 2 bytes on speeds higher then 4800. All bytes after the second one become corrupted (random bytes instead of expected data).
I tried two connection options: first is the serial adapter I described in one of my previous posts (based on 74LS04 inverters) and second is FT232RL. Results are the same.
The code is:
Code:
pause 500
arrTest      var byte(4)
mainLoop
    serin S_IN, i4800, [str arrTest4]
    shiftout p6,p7, msbpre, [arrTest(0), arrTest(1), arrTest(2), arrTest(3)]
goto mainLoop

I use RXTX serial communication Java library to generate serial stream. If I insert 1 ms pauses between individual characters transmission becomes stable and long strings can be transmitted that way.
Another interesting observation is that when I insert INTF = 0 statement at the beginning of the program (right after the array declaration) only one byte can be transmitted reliably, all subsequent ones become scrambled.

Ken, I'm starting to have doubts about your motto on assembly and finishing the project before retirement. :)
Please, let me know if you need any additional info to reproduce it.
Thank you.


Top
 Profile  
 
 Post subject: Re: Another SERIN bug
PostPosted: Fri Feb 26, 2010 1:37 am 
Offline
Master

Joined: Sun Aug 17, 2008 5:26 pm
Posts: 798
Location: CA bay Area
What can I say, Rita? I just measured the bit cell period for a programming download and it was 8.79us. This is approx. 113KBaud. Your slowpoke 4800 Baud is 206us. This is on the same pin, doing bitbang. The manual says the Nano's bitbang serial is good for up to 38400 Baud. So your 4800 is well within this range, but the very high download speed for programming speed is a mystery. But, hey, it works.

At this point I throw my hands in the air. You are using a home made circuit board with questionable translation circuitry to deal with the RS232 signals. Once it started programming reliably you pronounced it usable. I have no idea what your training or capabilities are. Maybe you you do great soldering on protoyping circuits, maybe not. Maybe your components are serviceable, and maybe they aren't. Perhaps your PC is on it's last legs and the serial port is questionable. I have no knowledge about the Java program you're using to exercise your circuit. I know diddley about assembly, so can't say why "INTF = 0" slams the circuit. I can't look over your shoulder. I give up.

In the future I recommend you call
1-800-535-9161 (BasicMicro)
and press the number for support. Only they have the expertise to answer your questions at this point.
Take care.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
 Post subject: Re: Another SERIN bug
PostPosted: Fri Feb 26, 2010 8:44 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 500
Hi Rita,

If this is your total program, I am like Ken and wondering if it is specific to your setup. Now if you said you had other things in your program like HSERIAL enabled or HSERVO or anything else the generates/process interrupts, I could easily suspect that.

However I would not rule out issues with serin either. Since I don't have one of these chips I can not test it. If you have some form of Oscilloscope or logic analyzer I would personally try hooking it up to your IO pin and see what you are getting. Why? On an Atom Pro 28, I can not use:
serin xxx,i115200, [...] to talk to a Lynxmotion SSC-32. It has obviously not worked for a long time if ever at that baud rate as all of the programs and tutorials up on the Lynxmotion website use i38400, yet the Bap should be able to go at that speed. (I wrote my own assembly language functions which work fine at this speed) So I checked on my logic analyzer and found that the analyzer thinks the output is at the speed 125000. The developer has been notified on hopefully he can fix it.

Good Luck
Kurt


Top
 Profile  
 
 Post subject: Re: Another SERIN bug
PostPosted: Tue Mar 02, 2010 11:13 pm 
Offline
Citizen

Joined: Mon Feb 01, 2010 9:40 pm
Posts: 43
Thank you for your reply, Kurt. I analyzed the serial signal I was getting from the computer port and it looks completely normal: right baud rate and stable clock. I did not set any interrupts either.
Actually, this message was just a bug report for BasicMicro, not a call for help. At the moment I'm testing Atmel's ATTiny because I want to chose the best platform before I commit to it and so far I definitely like AVR better. I won't go into details here because it would be incorrect to advertise Atmel platform on a BasicMicro forum ;)
I'll probably find some use to the few Nano modules I have, but it will be something simpler and not requiring any serious speed.
Have a good one,
Rita


Top
 Profile  
 
 Post subject: Re: Another SERIN bug
PostPosted: Thu Mar 04, 2010 7:59 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 500
Understood ;)

However I will give a couple of other things you might try just in case. Also because maybe someone else will run into the same problem...

The only other things I would have suggested was to try to change stuff on the PC side.
a) Can you change the baud rate or is specific to some device.
b) Since you can receive 1 or 2 characters before it gets corrupted maybe the code is on the edge on picking up the next start bit. Can you change the comm port on the PC side to use 1.5 or 2 stop bits?

Good Luck

Kurt

P.S. - I also like Avr processors, but as you said that is a topic for a different place. I also like the Renesas H8 processors used in the Atom Pros!


Top
 Profile  
 
 Post subject: Re: Another SERIN bug
PostPosted: Thu Mar 04, 2010 9:20 am 
Offline
Citizen

Joined: Mon Feb 01, 2010 9:40 pm
Posts: 43
I just thought that usually people use SERIN to read manual input from the terminal which is very slow. I'm not sure if anyone tried to read a string of bytes sent back to back immediately one after another. Yes, I also got impression that SERIN may have it's serial timing a bit off and when the data is coming in too fast it does not have time to adjust, so it accumulates over the first couple of bytes.


Top
 Profile  
 
 Post subject: Re: Another SERIN bug
PostPosted: Thu Mar 04, 2010 9:52 am 
Offline
Master

Joined: Tue Nov 21, 2006 9:34 am
Posts: 500
Yep that is one place I use serin, but I also use it for:

a) Talking to an SSC-32 servo control board, which I would like as fast as possible
b) Talking to an XBEE which is talking to some other xbee like control input from remote control again I am talking at something like 62500.
c) Soon maybe try the serial communications to the BM Motor controller with encoder support :D
D) GPS and other sensors that output in serial format.
...

As you said there could be an accumulation error, which is why I suggested the stop bit change. Likewise I have had problems if I have any of the hardware support functions enabled (HSERIAL, HSERVO...) or my own stuff that generate and process interrupts. That is why many times in my code you will see things like:
disable...
serin/serout...
enable...

Good Luck
Kurt


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 8 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO