11 years, 6 months ago.

SPI: force SCK to HIGH or LOW for more than a clock cycle

Hello,

trying to talk to the ADS1252 (24-bit ADC by TI). According to the data sheet and scattered online sources, the chip has to be reset by setting SCK to high for a number of conversion cycles. Is there a possibility to do that within the framework of the MBED SPI libraries?

You actually communicate with the chip only via MISO and SCK, the ADS1252 has no SPI in.

Thanks,

JJ

2 Answers

11 years, 6 months ago.

Problem is he doesn't need to clock the SPI, but keep it high for a while.

If it needs to be done only once, you can first make a DigitalOut, and then in your code after a while make an SPI object there.

Jay Zee
poster
11 years, 5 months ago.

Yes, it needs to be done only once. So, you suggest declaring the the SCK pin as a DigitalOut first, and then LATER in the code declare the SPI, correct? I'll go try this, but does anybody have any concerns about the scope of the SPI, shouldn't it be global? Surely you cannot declare a DigitalOut and SPI on the same pin?

JJ

You can declare both on the same pin, the one declared last is in principle used.

The scope can indeed be a problem. Then you can declare globally a pointer to an SPI object, and in the code with 'new' dynamically create an SPI object on those pins. That should do the same, but then you got the pointer globally available.

posted by Erik - 24 May 2013