1-Wire on Q2686 or Q2406

Hello all!
I intend to build remote data logging system based on a Q2686 or Q2406 modules. I want to use 1-Wire interface to communicate with data loggers, thus I need sotfware to operate with GPIO pins on a 142 Kbit/s speed. Does Open AT platform allow me to do this? Or the time limitations is very strict and I have to search for some other solutions for my core? May I link third-party 1-Wire-libraries, if any, with main C++ application to try to avoid this limit? May I write my own library in assembly language?

I’d also be interested in 1-Wire on Open-AT - see wavecom.com/modules/movie/sc … =1760#1760

As far as I’ve known, there are no way to switch GPIO pins as fast as we need for 1-Wire to be realised on Wismo modules. So we managed to use alternative technicque. We chose the Q2406 as a ‘master’ and made SPI-to-1-Wire converter based on small MSP430 microcontroller. Нowever, we could just take DS1982 instead of auxiliary microcontroller, but DS1982 is tied to cable 1-Wire medium, while we want to make our 1-Wire net wireless in future, i.e. to connect 1-Wire devices to Q2406 using ZigBee or some other RF protocol. Using microcontroller as a protocol converter gives us a flexibility in such kind of future upgrade - if in SPI-to-wireless-1-Wire protocol converter we would follow the same command protocol we’ve defined for ‘legacy’ converter made before, we only have to rebuild 1-Wire part of project, while the main application running on Q2406 would remain intact.

Note that Maxim/Dallas have a couple of chips to do I2C-to-1-Wire:

DS2482-100: maxim-ic.com/quick_view2.cfm/qv_pk/4382
I2C to 1-Wire Bus Master with single 1-Wire I/O channel

DS2482-800: maxim-ic.com/quick_view2.cfm/qv_pk/4338
I2C to 1-Wire Bus Master, 8 independent 1-Wire I/O chans

Perhaps these could be used on the Wismo’s I2C…?

Oh, sorry, in my post I wrote part number incorrectly - of course I mean DS2482-100, not DS1982 which is only iButton.
But, as I wrote above, DS2482 has its own command protocol, and should we move to wireless 1-Wire medium in future, embedded application on Q2406 tied to this native DS2482 commands will have to be rewritten for some new kind of 1-Wire adapter. That is why we chose to build our own adapter with our own native commands we would able to implement in future versions too.

Hello Pavel,

I would to use DS2482 with Q2686, I’d like to know if you have some example code for starting to use it. I’ll apprecciate any help.

Thank you.

Raffaele

Hello,

You can always look around the linux community.

At least you can get some good ideas how to use this I2C-1wire converter chip, so you can make the Open AT code in less time.

http://www.gelato.unsw.edu.au/lxr/source/drivers/w1/masters/ds2482.c

Cheers,
tom

Hello!
1-Wire on Q2686 without using an external converters is still impossible?

Greetings zz

I know of nothing that’s changed to enable it…

I had the same Problem once and now i use the DS2482 too.

Think it’s inposible otherwise, the Q2686 can not change the direction fast enough

Here’s some exaplecode with I2C, hope it helps

const u8 DS2482_CHIP_ADR = 0x18;
const u8 DS2482_ADR_LEN  = 8;

enum DS2482_Commands
{
    ONE_WIRE_SEND_BIT=0x87,
    ONE_WIRE_SEND_BYTE=0xA5,
    ONE_WIRE_READ_DATA=0x96,
    ONE_WIRE_RESET=0xB4,
    WRITE_NEW_CONFIG = 0xD2,
    READ_DATA_REGISTER= 0xE1,
    DATA_REGISTER =0xE1,
    RESET = 0xF0
};

typedef struct
{
    u32 command;    // Read/Write Start Address
    u32 length;     // Data buffer length
    u8*  data;      // Data buffer
} i2c;
/***************************************************************************/
void i2cInit(void)
{
  u32 length=DS2482_ADR_LEN;

  TRACE((TL_DS,"i2cInit()"));

  if(i2cInitital==FALSE)
  {

    adl_busI2CSettings_t i2cSettings =
    {
          DS2482_CHIP_ADR, //Chip Adress
          ADL_BUS_I2C_CLK_STD //Std Speed
          // 7 Adressbit, BusMaster
    };

    i2cBusHandl = adl_busSubscribe ( ADL_BUS_I2C,
                                      1,
                                      &i2cSettings );

    //8-Bit-Adresscode
    adl_busIOCtl( i2cBusHandl, ADL_BUS_CMD_SET_ADD_SIZE, &length);

    i2cInitital=TRUE;
  }
}
/***************************************************************************/
void busywait(u32 timedelay)
{  //---> :(
    u32 j=100;
    timedelay*=j;
    for(;timedelay>0;)
    {
        timedelay--;
        j=j;
    }
}
/***************************************************************************/
void i2cDataWrite(i2c* buf)
{
    u32 sRet;

    adl_busAccess_t *I2CBus_Access;

    I2CBus_Access=computeBusAccess(buf->command);

    busywait(100); //Wait till the one Wire-Communication has finished

    /* I2C bus write */
    sRet = adl_busWrite ( i2cBusHandl,
                          I2CBus_Access,
                          buf->length,
                          (void*)(buf->data) );

}
/***************************************************************************/
void i2cDataRead(i2c* buf)
{
    u32 sRet;
    u32 length=0;

    adl_busAccess_t I2CBus_Access={0,0};

    busywait(100); //Wait till the one Wire-Communication is finished

    //Set Adress (Command-Length to 0)
    sRet=adl_busIOCtl( i2cBusHandl, ADL_BUS_CMD_SET_ADD_SIZE, &length);

    // I2C bus read
    sRet = adl_busRead ( i2cBusHandl,
                   &I2CBus_Access,
                   buf->length,
                   (void*)(buf->data) );

    //Reset Adress (Command-Length)
    length=DS2482_ADR_LEN;

    sRet=adl_busIOCtl( i2cBusHandl, ADL_BUS_CMD_SET_ADD_SIZE, &length);

}
/***************************************************************************/
void oneWireReset(void)
{
    i2c* buf;
    u8* P1;

    buf = adl_memGet ( sizeof ( i2c ));

    P1=adl_memGet(1);

    P1[0]=0x00;

    buf->command=ONE_WIRE_RESET;
    buf->length =1;
    buf->data = P1;

     i2cDataWrite(buf);
}
/***************************************************************************/
u8 oneWireRead(void)
{
    i2c* buf;
    i2c* readBuf;
    u8* P1;
    u8* P2;

    buf = adl_memGet ( sizeof ( i2c ));
    readBuf = adl_memGet ( sizeof ( i2c ));

    P1=adl_memGet(1);
    P2=adl_memGet(1);

    P1[0]=0x00;
    P2[0]=0x00; //Overwrite by Data

    //Read on One-Wire

    buf->command=ONE_WIRE_READ_DATA;
    buf->length =1;
    buf->data = P1; //Nothing

    i2cDataWrite(buf);

    //Prepare to Read, set Pointer to Data-Register

    P1[0]=DATA_REGISTER;

    buf->command=READ_DATA_REGISTER;
    buf->length=1;
    buf->data=P1; //Read RegisterData

    i2cDataWrite(buf);

    //Read the Register

    readBuf->command=0x00; //No Adress needed
    readBuf->length=1;
    readBuf->data=P2;


    i2cDataRead(readBuf);

    return readBuf->data[0]; //Return Data
}
/***************************************************************************/
void oneWireWrite(u8 command)
{
    i2c* buf;
    u8* P1;

    const u16 dataLength = 1;

    buf = adl_memGet ( sizeof ( i2c ));

    P1=adl_memGet(dataLength);


    buf->command=ONE_WIRE_SEND_BYTE;

    buf->length=dataLength;

    P1 [0]=command;

    buf->data = P1;

    i2cDataWrite(buf);
}

I used this code for a DS2482

To read the temperature the code looks like this:

//DS2482-Reset
    oneWireReset();
    oneWireWrite(SKIP_NET_ADR); //0xCC
    oneWireWrite(READ_DS_DATA); //0x69
    oneWireWrite(TEMP_MSB); //0x18

    tempMSB=(oneWireRead()&0x00FF);

    tempLSB=(oneWireRead()&0x00E0);

What about IESM with usb and ds2490 usb-OW adapter?
Yves

That would require a USB Host - the IESM has only a USB [i]Device /i port.

You are rigth, was assuming the usb on IESM could behave host or slave.
There is also DS9097U-009 - Serial 1-wire/ibutton adapter (RJ11) which I never used but could be connected to the uart1 or 2.
Yves