Can anyone confirm my suspicions

oracacle

Senior Member
I am working on a project for a set of sensors. The main controller which is a 28x2 talks to a 08m2 through c.4 and c.2. there is another 08m2 connected to c.0 and c.5
I disconnect command is given at the top of the programme. The 28x2 shows its sensor fault detection with the second 08m2 is connected (problem with first 08m2), if its not connected the first 08m2 runs as expected. the second 08m2 runs as expected.
I have not used a switch to switch between the download circuit and the second 08m2 - the download circuit remains connected at all times at the moment
As far as I can tell the first 08m2 is resetting as the command strait after disconnect is to send c.4 high which its not doing while the second 08m2 is connected

I should mention that the second 08m4 pin c.4 (this is also sent high strait after the disconnect command is given) is connected to pin c.5 of the first 08m2. I suspect that when the second 08m2 is sending the first 08m2 into reset or possibly download programme mode despite the disconnect.
The sensors final design should be that they are identical and that a large number of the can be "daisy chained" together (ie commands come into the first one via c.2 and go out to the next sensor via c.0, and back the other way via c.5 and c.0).
here is a snipet of code that the sensor will hopefully run
Code:
[color=Blue]symbol laser      [/color][color=DarkCyan]= [/color][color=Blue]c.1             [/color][color=Green]'pin to switch laser on or off[/color]
[color=Blue]symbol [/color][color=Purple]sense      [/color][color=DarkCyan]= [/color][color=Purple]pinc.3          [/color][color=Green]'input from S6986 sensor
'to next sensor[/color]
[color=Blue]symbol casout     [/color][color=DarkCyan]= [/color][color=Blue]c.0             [/color][color=Green]'cascade output[/color]
[color=Blue]symbol [/color][color=Purple]casin      [/color][color=DarkCyan]= [/color][color=Purple]pinc.5          [/color][color=Green]'cascade in[/color]
[color=Blue]symbol cascserial [/color][color=DarkCyan]= [/color][color=Blue]c.5[/color]
[color=Green]'to previous sensor or controller[/color]
[color=Blue]symbol prevout    [/color][color=DarkCyan]= [/color][color=Blue]c.4
symbol [/color][color=Purple]previn     [/color][color=DarkCyan]= [/color][color=Purple]pinc.2[/color]
[color=Blue]symbol prevserial [/color][color=DarkCyan]= [/color][color=Blue]c.2

symbol baud       [/color][color=DarkCyan]= [/color][color=Blue]n2400_16

symbol [/color][color=Purple]flag       [/color][color=DarkCyan]= [/color][color=Purple]b0              [/color][color=Green]'flag variable[/color]
[color=Blue]symbol [/color][color=Purple]address    [/color][color=DarkCyan]= [/color][color=Purple]b1              [/color][color=Green]'address variable[/color]
[color=Blue]symbol [/color][color=Purple]instruct   [/color][color=DarkCyan]= [/color][color=Purple]b2              [/color][color=Green]'instruction variable[/color]
[color=Blue]symbol [/color][color=Purple]number     [/color][color=DarkCyan]= [/color][color=Purple]b3              [/color][color=Green]'number of sensors (address + 1)[/color]
[color=Blue]symbol [/color][color=Purple]escflag    [/color][color=DarkCyan]= [/color][color=Purple]b4[/color]
[color=Blue]symbol [/color][color=Purple]mode       [/color][color=DarkCyan]= [/color][color=Purple]b5[/color]
[color=Blue]symbol [/color][color=Purple]loopnumber [/color][color=DarkCyan]= [/color][color=Purple]w3[/color]
[color=Blue]symbol qual       [/color][color=DarkCyan]= [/color][color=Red]"U"             [/color][color=Green]'qualifier varaible[/color]
[color=Blue]symbol type       [/color][color=DarkCyan]= [/color][color=Red]"L"             [/color][color=Green]'sensor type[/color]
[color=Blue]symbol test       [/color][color=DarkCyan]= [/color][color=Red]"A"             [/color][color=Green]'recieved from controller[/color]
[color=Blue]symbol send_test  [/color][color=DarkCyan]= [/color][color=Red]"B"[/color]
[color=Blue]let [/color][color=Purple]dirsc [/color][color=DarkCyan]= [/color][color=Navy]%00010011[/color]
[color=Blue]disconnect[/color]
[color=Black]init:
      [/color][color=Green]'this does no execute on first 08m2 if second 08m2 is connected
      [/color][color=Blue]high prevout                              [/color][color=Green]'send here signal to previous
      [/color][color=Blue]let [/color][color=Purple]loopnumber [/color][color=DarkCyan]= [/color][color=Navy]0
      [/color][color=Blue]pause [/color][color=Navy]250
      [/color][color=Blue]high casout                               [/color][color=Green]'send signal to next sensor
      [/color][color=Blue]do while [/color][color=Purple]previn [/color][color=DarkCyan]= [/color][color=Navy]0                       [/color][color=Green]'wait to recieve 'heard' signal from previous
            [/color][color=Blue]inc [/color][color=Purple]loopnumber                      [/color][color=Green]'or wait for period of time before leaving
            [/color][color=Blue]if [/color][color=Purple]loopnumber [/color][color=DarkCyan]= [/color][color=Navy]20000 [/color][color=Blue]then exit
      loop
      low prevout                               [/color][color=Green]'stop sending here signal when heard signal recieved
      [/color][color=Blue]if [/color][color=Purple]casin [/color][color=DarkCyan]= [/color][color=Navy]1 [/color][color=Blue]then
            let [/color][color=Purple]escflag [/color][color=DarkCyan]= [/color][color=Navy]1
      [/color][color=Blue]end if
      pause [/color][color=Navy]1000                                [/color][color=Green]'weigth for previous to listen for sensot type
      [/color][color=Blue]if [/color][color=Purple]loopnumber [/color][color=DarkCyan]> [/color][color=Navy]19000 [/color][color=Blue]then [/color][color=Black]dumb_sensor[/color]
I am thinking I may have add in a switch of jumper to either download or run as per normal. a DPDT so that both serial in and serial out can be switch at the same time seems like a logical choice for this.
hopefully I have made sense
 

hippy

Technical Support
Staff member
Perhaps post a diagram as to exactly how everything is connected ( including pull-ups and pull-downs, and other resistors ) to make it easier to follow, but I would guess that using C.5 ( download serial in ) as an input on an 08M2 is causing that to misbehave.

Input C.5 has to be kept low on an 08M2 until a DISCONNECT command has been executed for reliable operation, cannot be high or floating. That would normally be achieved by setting the output pin controlling it low with a pull-down resistor keeping it low until the pin becomes an output -

Code:
                  08M2
.-----.         .------.
|     |----.--->|C.5   |
`-----'   .|.   `------'
          |_|
          _|_ 0V
If you want to have download programming as well it gets a bit more complicated. This should work but untested -

Code:
SO <-----------------------------------.     
                ___         .--------. |
SI >------.----|___|---.--->|C.5  C.0|-'
         .|.    22K    |    `--------'
0V --.   |_|10K        O-.
    _|_  _|_             | Link = Run
                       O-'
    .------.           |
    |      |-----------'
    `------'
Remove the link, insert the download cable to re-program.

Insert the link for normal running. It probably will work with download cable left in place for SERTXD / DEBUG debugging.

It might even be possible to get the 08M2 to auto-switch to downloading depending on what data normally goes in to C.5
 
Last edited:

oracacle

Senior Member
The 28x2 has 10k pull downs on each of its pins.

Judging from what you have said hippy, I am leaning towards there being some improvement if I were to use with a jumper or switch.

C.5 will be receiving serial primarily, but will have high/low and pulsing further down the line. If I hardware permits I would ideally use an interrupt later to detect a high input to c.5, but that's a ways down the line yet
 

Attachments

hippy

Technical Support
Staff member
A link should improve things, to disconnect the Serial In from "Next Sensor" when programming, or that sensor could corrupt the download.
 

oracacle

Senior Member
I added a switch into the download circuit, I still got the issue when the download circuit was disconnected, but when I disconnected the next sensor the problem went away.
so I moved the high prevout to after the pause 250 and now the system work with the download still connected

It appears there has to be some pause between the disconnect and the pin being pulled high

section now reads:
Code:
[color=Blue]let [/color][color=Purple]dirsc [/color][color=DarkCyan]= [/color][color=Navy]%00010011[/color]
[color=Blue]disconnect[/color]
[color=Black]init:
      [/color][color=Green]'this does no execute on first 08m2 if second 08m2 is connected
      
      [/color][color=Blue]let [/color][color=Black]loopnumber [/color][color=DarkCyan]= [/color][color=Navy]0
      [/color][color=Blue]pause [/color][color=Navy]250
      [/color][color=Blue]high [/color][color=Black]prevout                              [/color][color=Green]'send here signal to previous
      [/color][color=Blue]high [/color][color=Black]casout                               [/color][color=Green]'send signal to next sensor[/color]
and was:
Code:
[color=Blue]let [/color][color=Purple]dirsc [/color][color=DarkCyan]= [/color][color=Navy]%00010011[/color]
[color=Blue]disconnect[/color]
[color=Black]init:
      [/color][color=Blue]high [/color][color=Black]prevout                              [/color][color=Green]'send here signal to previous
      [/color][color=Blue]high [/color][color=Black]casout                               [/color][color=Green]'send signal to next sensor
      [/color][color=Blue]let [/color][color=Black]loopnumber [/color][color=DarkCyan]= [/color][color=Navy]0
      [/color][color=Blue]pause [/color][color=Navy]250[/color]
thanks for your help, I don't know at this point how small or large the period of time between the disconnect and c.5 being sent high needs to be. I have margin for detecting sensors and the pause 250 is there to try and let things settle in the main controller as it has a few things it need to do first.
 

hippy

Technical Support
Staff member
I expect what is happening is the chip is starting just a little sooner than the one it feeds into, is setting it's output high before the other has disconnected.

There can be slight differences in start-up times between chips so a delay and/or executing initialisation commands before setting the output high should overcome that. The download circuit will pull the line low before the feed-in drive becomes an actual output.

It's probably a good idea to do the DISCONNECT before the 'dirs=".
 
Top