This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

problem with SPI & MAX6662 (at89s8252)

I have problem with implementing MAX6662 chip. I have already interfaced ds1306 rtc with 3wire serial interface and it works. The problem is that the max6662 uses non usual spi interface. There are no mosi/miso pin instead of this there is one bi-directional pin DQ for data transfers. Can this chip be interfaced to this microcontroller ? How to do that (mayby use tri-state buffer's) ? For first i connected mosi and miso line from uC together and use this code:

void spi_wr(unsigned char d)
{
   SPDR = d;
   while ((SPSR & 0x80) == 0)
      ;
}

unsigned char spi_rd(void)
{
   unsigned char v;
   SPDR = 0xFF;
   while ((SPSR & 0x80) == 0)
      ;
   v    = SPDR;
   return (v)
}


And the code for gathering temp:

  ...
  CS = 0;
  spi_wr(0xC1);
  hi = spi_rd();
  lo = spi_rd();
  CS = 1;
  ...

This is not working. Second problem is that ds1306 uses two data lines and do not respond when lines is connected with each other.

Is there work around ? Or somebody know some spi temp. chip with normal spi interface ?

sorry for my broken
English
Lukasz Bajger

Parents
  • I've used the AD7814 IC before with some success, although it's got less precision than the part you selected. It does, however, have both data in and data out lines like your rtc. I have to imagine that there's a way to interface both of these to the same bus, however. Quasi-SPI devices with a bidirectional pin are pretty common, so someone must have hit this wall before.

Reply
  • I've used the AD7814 IC before with some success, although it's got less precision than the part you selected. It does, however, have both data in and data out lines like your rtc. I have to imagine that there's a way to interface both of these to the same bus, however. Quasi-SPI devices with a bidirectional pin are pretty common, so someone must have hit this wall before.

Children