i2c nack or ack from slave on address - arm

I am trying to interface with a module using the i2c protocol.
the modules(slave) address is 0x48.
What I am trying:
send 0x48(it's adress) to the module. After which I should receive an ACK.
But it seems as if i don't receive an ack or am I wrong?
If I do effectively don't get a proper ACK, how does it come?
All i do is reset the module, so it is in a known state and afterwards I just send 0x48 (and 0x00 as data).
for info: i am using a 32-bit ARM controller and 1k5 pullup resistors
an image of what I see on an oscilloscope:

Related

What meant by link change in network driver does this means TX to RX so there is link change or is it speed like data transfer phydev->speed or what

Why drivers raise PHY interrupt. Is it this the job of Kernel so why driver part of kernel raising PHY interrupt like
u32 status = //read registers
if (status & LinkChg_Status)
phy_mac_interrupt(tp->phydev);
above code is in request_irq(pci_irq_vector(pdev, 0), rtl8169_interrupt, interrupt context
on kernel.org it says
Sometime during startup, the network driver needs to establish a connection
betweenthe PHY device, and the network device. At this time, the PHY's bus and
drivers need to all have been loaded, so it is ready for the connection. At this
point, there are several ways to connect to the PHY:
The PAL handles everything, and only calls the network driver when the link state
changes, so it can react.
in above statement what is link state changes might be? does this mean at one state its TX and at link change to RX?
from The datasheet it says its
Packet Underrun/Link Change: This bit is set to 1 when CAPR is
written but the Rx buffer is empty, or when link status is changed.

I2C from master to slave communication problem

I am using TC237 and the board does not provide I2C communication, so I implement it as GPIO.
Reads and writes through registers, but no master-slave communication.
According to the I2C communication protocol, the start-stop ACK NACK function code was created.
I also create a 1-byte write and read code, and based on it I create code to read and write to the registers of the slave.
I do not know how to upload a picture, but when I check the SDA and SCL with the oscilloscope, when I read it, it seems that there are two bytes to read and the rest is OK. The first byte reads 0x00 and the next byte reads 0xEF.
I2C_Start();
waitTime(1*TimeConst_100us);
I2C_WriteByte((uint8)(Slave_addr|0x01));//LIDAR : 0xC5/BH1750 : 0x27
I2C_ACK();//I2C_GetACK();
I2C_ReadData_H = I2C_ReadByte();
I2C_ACK();
waitTime(1*TimeConst_100us);
I2C_ReadData_L = I2C_ReadByte();
waitTime(1*TimeConst_100us);
if(I2C_NACK() == BUSY)
{
return RESET;
}
I2C_Stop();
return SET;
The result should be received by the internal IC, but it receives a strange value.
The suspicious part seems to not receive an ACK from the device after reading the first byte, what should I do?

STM32 I2C set SDA to low

Is there any way to set the SDA and SCL pin of the I2C1 connection of the STM32 to low or high signal?
I use a security chip and I have to send a wake condition, with the following condition:
if SDA is held low for a period of greater than 60us, the device will exit low power mode and
after a delay of 1500us, it will be ready to receive I2C commands.
I've already tried to toggle the actual pin with HAL_GPIO_TogglePin(GPIOB, GPIO_PIN_9);, but this isn't working.
I've configured my project with STM32CubeMX.
Thanks for your help.
In I2C, the START condition requires a High to Low transition, if you then send a dummy address 0, a NACK will be generated (or rather the lack of any response will be interpreted as a NACK). In a normal transaction, the software would respond to the NACK by generating a repeated START or a STOP condition, however this must be done in software, so all you have to do is nothing for 1.5ms. Thereafter you can generate the START with the device's actual address, and if the device is running it will generate an ACK.
I am not familiar with the HAL library driver, and frankly the documentation is abysmal, but it is possible that it does not give you the necessary control, and you will have to access the I2C peripheral at the register level for at least this procedure. You might try a zero-length I2C_MasterRequestWrite() call to address zero followed by a delay. An oscilloscope would be useful here to ensure the expected signal timing is being generated.
When you initialize I2C, GPIO pins mode is set to ALTERNATE MODE,so writing HAL commands won't work on it.
Using normal HAL libraries won't help you in this. You have to configure I2C protocol on your own using stm32 registers.
I recommend that the ownaddress of the slave address using the device of the using I2C channel sets like the below code.
I2C_InitStructure.I2C_OwnAddress1 = 0x30; // the unique slave address of the deviecs
because the master could be send the broadcast operation not the unique operation.

MQTT ISSUE: Broker closing connection as i send connect packet

Its my first post here. Correct me if im wrong
I'm using free scale controller with G620 module for connecting to server.
I started to implement MQTT client.
The communication with G620 GPRS module through UART.
Through AT commands i connected to the MQTTbroker.
As soon as i sent the connect packet, broker closing the connection.
Need help or suggestion.
The connect packet is: { 0x10,0x12,0x00,0x04,M,Q,T,T,0x04,0x00,0x3C,0x00,0x00,0x06,Z,1,2,1,2,3
}
There are two scenarios the server is disconnecting you as per MQTT Protocol.
1. If you are violating protocol format
2. If the timeout of the connection is exceeded
Reasons for Protocol Violation termination:
- You might have wrongly framed out some protocol bytes. Cross verify with the protocol document.
- You might be already connected and trying to connect again. Check for server side logs if you have access.
- As you are sending the frame through UART, you might have used a for loop to send the bytes. If the for loop counter is based from "strlen(Connectpacket)", you will not get the exact count as "strlen" will terminate after 0x00. So the server will receive half packet and disconnects you for violation.
Your protocol seems to be invalid,
0x10 - MQTT Control Packet type
0x12 - Remaining Length
0x00 - Length MSB
0x04 - Length LSB
M
Q
T
T - Protocol Name
0x04 - Protocol Level
0x00 - Connect Flags
0x3C - Keep Alive MSB
0x00 - Keep Alive LSB
0x00,0x06,Z,1,2,1,2,3 - What are there bytes used for? Cross verify with protocol document.
Set clean session bit as 1. Set keep alive for 0x00 MSB 0x3C LSB.

RTC not acknowledging slave address

I'm writing a driver for m41t83 RTC IC and on AT91SAM7X (based on ARM7).
I'm trying to start communication with it over TWI (fast mode) and I have no response from the RTC (always get NACK).
I don't know what might cause the problem. Attached here some photoes to clock and data wires on oscilliscope where I send the RTC address 0x68 after the start condition and send write bit but receive a NACK.
I tryed ST's forum but in vain

Resources