i2c master for s35390a rtc slave - i2c

Is there a sample i2c master code that supports rtc s35390a hardware clock? I am currently working on an SOC that needs to support s35390a from Seiko. But currently, i am getting an error rtc-s35390a 0-0030: hctosys: unable to read the hardware clock. I cannot read/write data properly. I am implementing combined form of transmission.

Use oscilloscope to check if I2C SCL/SDA show some thing
If you can get the first address correct waveform, You will easy to get the register value
This might not be a rtc chip problem.

Related

I2C communication between LTC6804-1 and STM32 Nuclue F446RE

I am trying to build a small battery monitoring system using LTC 6804-1 IC which will send the cell voltages over I2C to my STM32 Nucleo board. I have read and understood I2C and how to use the HAL APIs for communication. However, I am not able to understand anything about the communication from the datasheet of LTC 6804-1. https://www.analog.com/media/en/technical-documentation/data-sheets/680412fc.pdf I was looking for the slave address it sends data to and also the length of data. But I can see configuring some data registers which is bit of confusing. At point I do not know where to even start? Or is it actually easy that I have to connect wires and it starts?
Any help would be highly appreciated. Thanks!
The LTC6804 is not using I2C for communication, it's using SPI. It can host I2C communication to a slave device. Reread the data sheet thoroughly. Although I must agree, the manual is not really written very well, or at least there could be a lot more info, not only on how to get started...

How Multiple slave to single master SPI software slave management works

I am using STM32H7 family of microcontroller as SPI Master Transmit device which needs to talk to 4 SPI slave devices receive only which are also all STM32H7 MCU's. Both master and slave are configured for software slave management.
The confusion is how slave will identify when master wants to talk to it or transmit data to it without using hardware NSS pin?
How slave device will start receiving in this scenario and stop receiving when all data transmitted?
If you use software slave select (NSS), you must select and deselect the SPI interface by software.
Typically, you would setup an external interrupt on the pin used as NSS/CS and select/deselect the SPI interface when the interrupt is triggered.
On an STM32F1 chip, the SPI interface is selected/deselected by setting/clearing the SSI bit in the SPI_CR1 register. I assume it's very similar on a STM32H7 chip.
Update
I've just checked the STM32H7 and it's exactly the same.
It is very simple. Every slave has one pin called CS. You need to select this device by setting this pin just by using the GPIO. Then you can transmit or receive data. Remember that master has to supply clock even if it wants only to receive data.
It seems that the code shown below can manage the problem.
__HAL_SPI_ENABLE(&hspi1);
__HAL_SPI_DISABLE(&hspi1);

Coding Raspberry Pi with an ADC - SPI

I am trying to connect an analogue to digital converter to the raspberry pi. As far as I am able to understand, the RPi doesn't support Bi-directional SPI mode. The adc I am using says it is SPI compatible but only has the inputs SCLK, CNV and outputs CLKOUT+ and CLKOUT- and SD0+ and SD0-. This leads me to understand that it will only work with bi-directional SPI as there is only the serial data out. I am thinking of using a PWM for CNV (which I think CE), GPIO clock for SCLK and then an interrupt on the falling edge of the GPIO clock to just digitally read each bit from the adc. I don't understand SPI in detail but from what I've read quite often it requires sending data in order to receive it. Do you know if the setup I mentioned (without using SPI) will work? Or am I missing something about SPI and the adc will work with that while not in bi-directional mode?
We are using the Raspberry Pi 3 b
adc - http://cds.linear.com/docs/en/datasheet/232316fa.pdf
Thanks for any help you can provide.
Read the data sheet carefully, in particular pages 8 and 9. I suggest that you tie CMOS/LVDS pin to ground to enable CMOS mode. Then use only the "+"-pins. Use the SCK for SPI clock, SD01+ for SPI data input to the Rpi. Connect a GPIO pin to CNV.
Also observe that the RPi runs at 3.3V, and the ADC's max rating is also 3v3, that is running the IC right to the edge.

How to upload an Arduino source code to a Lilypad Arduino?

I bought a Lilypad Arduino, for which an FTDI socket is required to connect to my PC. The first socket I tried on didn't power up the Arduino, because of some hardware damage. Thus, I got another socket, but with 4 female pins (Vcc, Gnd, TX, RX), unlike the previous one that had 6 male pins. Let's call the second socket as X. With X, the Lilypad is getting powered up through USB cable. Then, when I tried to upload my source code the first time, it started working.
But when I uploaded it some time later, an error called 'programmer is not responding' occurs always, which I'm unable to resolve.
What should I do?
To program an Arduino (and Arduino-compatibles), you need an FTDI adapter that has an RTS pin, as well as the Vcc, Gnd, TX, and RX pins.
The RTS pin connected to the reset circuit on the Arduino, putting the bootloader into programming mode for a few seconds.
You may be able to get it to work by resetting the Lilypad with it's reset button, then upload your sketch within a few seconds after the reset. Alternatively, or for the least hassle, get an FTDI adapter with all the needed signals. I recommend Adafruit's FTDI Friend.

Set initial state as input on pins using FTDI device FT4232H

I am using a USB device from FTDI called FT4232H and I want to write on the EEPROM to make sure that some pins are set to inputs at start. I am using the D2XX drivers (pdf here). Here I found at page 106 that there is a struct called FT_EEPROM_4232H. Could this be something to use to make sure the pins are set to inputs at the beginning or is this totaly wrong? There are four UCHAR variables called A-, B-, C- and DDriverType. Does anyone know what these should be used for?
I realise this question is 3 months old now but I believe pins on the FTx232H series of chips only get set as GPIO once the MPSSE command SetOutput is issued.
The EEPROM configuration is used to define things like drive strength, slew rate and whether the pin is a schmitt input and what each of the 4 ports are set up to be (async FIFO akin to FT245 series, serial port (FT232), etc).
If anyone else can disprove this, I would be interested to know also!
I just plugged my FT232H board in my PC and ran FTDI FT_Prog, it does not appears you can control the GPIO mode input/output at start time. There is nothing in the FTDI FT_Prog UI that allow to set a mode for GPIO pins and set them as input.
I did set programmatically my FT232H board as an SPI device with 8 GPIOS
but this was done after the chip was started.
A video experimenting with the FT232H
I also once asked FTDI support a similar question for the FT232RL which is as default a UART and I asked if there was a way to configure the chip to start in Synchronous bit banging mode and set the GPIOs as OUTPUT. The answer was no.
The FT232RL will always start as a UART and then by software I can activate Synchronous bit banging mode, and set the mode of my GPIO.
I suppose it is the same for the FT232H, FT2232H and FT4232H.