Paul Alfille-2 wrote:
> 
> That's a long pause -- even a reset should only be ~500 usec.
> 
> In fact you've given a great hint to the solution. There must be a
> discharge-all-lines command being sent.
> 

No, it wasn't a discharge-all-lines command. It is a bug in
BUS_select_subbranch.
In the DS2409 doc. it says that a SMART-ON MAIN command should follow 16
time slots, 8time slots (reset stimuli) generated by the bus master. See the
flowchart in the doc.

I have changed the function to (added write of 0xff, and read one byte
less):

static int BUS_select_subbranch(const struct buspath *bp,
                                                                const struct 
parsedname *pn)
{
    BYTE sent[11] = { _1W_MATCH_ROM, };
    BYTE branch[2] = { _1W_SMART_ON_MAIN, _1W_SMART_ON_AUX, };  /* Main, Aux
*/
        BYTE resp[2];
        struct transaction_log t[] = {
        TRXN_WRITE(sent,11),
        TRXN_READ2(resp),
                TRXN_END,
        };

        memcpy(&sent[1], bp->sn, 8);
        sent[9] = branch[bp->branch];
        sent[10] = 0xff;
        LEVEL_DEBUG("Selecting subbranch " SNformat "\n", SNvar(bp->sn)) ;
        if (BUS_transaction_nolock(t, pn) || (resp[1] != branch[bp->branch])) {
                        
STAT_ADD1_BUS(e_bus_select_errors,pn->selected_connection) ;
                        LEVEL_CONNECT("Select subbranch error for %s on bus
%s\n",pn->selected_device->readable_name,pn->selected_connection->name);
                return 1;
        }
        //printf("subbranch stop\n");
        return 0;
}

and now it works.

/Dag
-- 
View this message in context: 
http://www.nabble.com/Re%3A-Problem-with-temperature-reading-tp14197807p14262132.html
Sent from the OWFS - Dev mailing list archive at Nabble.com.


-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to