Page 1 of 2
BaiscChip hangs in SEROUT or bbTXD
Posted: Tue Sep 01, 2015 4:17 pm
by ronr
I have used SEROUT on a pin other than IO(0) or IO(1) with the ArmitePro with NO problems.
Now using the BasicChip, calling SEROUT may cause the BasicChip to just stop, when I make repeated calls to SEROUT.
Calling SEROUT often (just once a second) will cause a hang-up within a few seconds. Even after several seconds wait, the next call to SEROUT may hang.
I have used bbTXD instead and find the same problem.
I am using IO(41) as the TXD pin at 9600 baud. I have reduced the program, for testing, to do nothing but call SEROUT with a 3-character text string, in response to my commands on BasicChip's hardware serial, on IO(0) and IO(1).
What could be causing this problem? Something I'm doing wrong?
Thanks for any advice.
Re: BaiscChip hangs in SEROUT or bbTXD
Posted: Wed Sep 02, 2015 10:51 pm
by olzeke51
could you post your basic 3 character code ??
Thanx, Gary
'
are you getting the first one or two transmissions?
is it the straight BasicChip or is it on one of the boards.
TNX
Re: BaiscChip hangs in SEROUT or bbTXD
Posted: Thu Sep 03, 2015 6:54 pm
by ronr
I am just sending the 3-character string /HI
The first one or two or three transmissions go okay, then the next serout causes a hang-up. It happens for sure if I serout rapidly, like 2 or 3 per second. I use the same simple code in the ArmitePro (except for differences for the specific hardware) and it transmits as fast as I can command it.
Re: BaiscChip hangs in SEROUT or bbTXD
Posted: Fri Sep 04, 2015 4:18 pm
by basicchip
SERIAL.bas was written before the change of TIMER to use SysTick.
SysTick relies on interrupts being enabled and if they are disabled eventually you will hang up calling TIMER as it won't be able to increment across the 24 bit boundary (65 msec).
SERIAL.bas needs to be rewritten using WAITMICRO.
Re: BaiscChip hangs in SEROUT or bbTXD
Posted: Fri Sep 04, 2015 5:39 pm
by ronr
Thank you, sir, for that answer, which seems to give a real good reason for my problem. Is there anything I can do now in software to fix the problem for the BasicChip? It seems that right now my only solution is to design my new board around the ArmPro Board, which I have tested to work well.
Re: BaiscChip hangs in SEROUT or bbTXD
Posted: Fri Sep 04, 2015 9:02 pm
by basicchip
Give this one a try, all it does is change the wait loops inside the interrupt(0)/(1) to calls to waitmicro. To work on the ARMmite it would need a definition of waitmicro, but it should work on the newer Cortex parts.
I don't have time to test it now. If it works for you I'll put it in the next release.
Re: BaiscChip hangs in SEROUT or bbTXD
Posted: Sat Sep 05, 2015 10:43 pm
by ronr
I have tried that new Serial.bas and it works perfectly! Even looping in continual SEROUT calls for several seconds doesn't bother the BasicChip anymore. Thank you so much for providing this fix so quickly!
Re: BaiscChip hangs in SEROUT or bbTXD
Posted: Sun Sep 06, 2015 10:15 pm
by ronr
This may not be right place to post this but....I find a similar hang-up problem with repeated calls to PULSOUT and PULSIN.
This takes a bit longer to hang-up..like fifteen minutes of calling PULSOUT/PULSIN at about 7 to 10 times a second. (This is operating a Parallax "Ping" sensor.)
I have not yet done tests to see at what rate it might not hang-up.
Is there a similar timing problem that may be corrected with a newer PULSE.bas?
Thank you for your attention.
Re: BaiscChip hangs in SEROUT or bbTXD
Posted: Mon Sep 07, 2015 2:06 pm
by olzeke51
as Basicchip mentioned above ::
SERIAL.bas was written before the change of TIMER to use SysTick.
SysTick relies on interrupts being enabled and if they are disabled eventually you will hang up calling TIMER as it won't be able to increment across the 24 bit boundary (65 msec).
SERIAL.bas needs to be rewritten using WAITMICRO.
''
'
any of the routines.BAS that disable interrupts
INTERRUPT(0/1)are going to have issues.
You will need to rewrite the routine - a) removing the INTERRUPT() and b) use the WAITMICRO() for timing.
this is a community effort; especially now as hardware makes many advances
'
compare the old Serial.BAS to the one Basicchip just posted for ideas.
HTH, Gary
Re: BaiscChip hangs in SEROUT or bbTXD
Posted: Mon Sep 07, 2015 2:59 pm
by basicchip
PULSE.bas is really meant for people porting from BASIC stamps, it is much better to write your own routines using TIMER for long times or WAITMICRO for short times on the newer parts.
Again turning off interrupts, disables TIMER from counting across 65 msec boundaries. You can re-enable it by-
Code: Select all
INTERRUPT(0)
#ifdef ST_CTRL
ST_CTRL OR= 2 ' re-enable SysTick interrupt
#endif
This won't be as accurate as possible, but still far more accurate than a BASIC stamp.
So here is PULSE.bas without testing