This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSPM0G1106: ds1307 rx error

Part Number: MSPM0G1106

Tool/software:

When I changed the DS1307 data with the TEXAS processor and checked it with Arduino, I assigned the correct values ​​to the correct register. But when I want to study in Texas, I encounter the following image.

uint8_t readSecondsFromDS1307(void) {
  uint8_t seconds;
   uint8_t regAddr = Seconds;

// DS1307'den saniye register'ının adresini gönder
DL_I2C_fillControllerTXFIFO(I2C_INST, &regAddr, 1);

while (!(DL_I2C_getControllerStatus(I2C_INST) & DL_I2C_CONTROLLER_STATUS_IDLE));

// 1 baytlık veri (saniyeler) okumak için kontrolcü transferini başlat
DL_I2C_startControllerTransfer(I2C_INST, DS1307_ADDRESS, DL_I2C_CONTROLLER_DIRECTION_RX, 1);


// Veri FIFO'ya gelene kadar bekle ve oku
while (DL_I2C_isControllerRXFIFOEmpty(I2C_INST));
seconds = DL_I2C_receiveControllerData(I2C_INST);


if (DL_I2C_getControllerStatus(I2C_INST) & DL_I2C_CONTROLLER_STATUS_ERROR) {
printf("I2C Okuma Hatası!\n");
}

// Okunan saniyeleri BCD'den ondalık formata çevir ve döndür
//return bcdToDec(seconds);
return seconds;
}

  • Why did you start a new topic?

    You have to tell the DS1307 which register you want to read from. fillControllerTXFIFO does not send any bytes. Here is the relevant code from the TI example:

    /*
         * Fill FIFO with data. This example will send a MAX of 8 bytes since it
         * doesn't handle the case where FIFO is full
         */
        DL_I2C_fillControllerTXFIFO(I2C_INST, &gTxPacket[0], I2C_TX_PACKET_SIZE);
    
        /* Wait for I2C to be Idle */
        while (!(
            DL_I2C_getControllerStatus(I2C_INST) & DL_I2C_CONTROLLER_STATUS_IDLE))
            ;
    
        /* Send the packet to the controller.
         * This function will send Start + Stop automatically.
         */
        DL_I2C_startControllerTransfer(I2C_INST, I2C_TARGET_ADDRESS,
            DL_I2C_CONTROLLER_DIRECTION_TX, I2C_TX_PACKET_SIZE);
            
        /* Trap if there was an error */
        if (DL_I2C_getControllerStatus(I2C_INST) &
            DL_I2C_CONTROLLER_STATUS_ERROR) {
            /* LED will remain high if there is an error */
            __BKPT(0);
        }
    
        /* Wait for I2C to be Idle */
        while (!(
            DL_I2C_getControllerStatus(I2C_INST) & DL_I2C_CONTROLLER_STATUS_IDLE))
            ;
    
        /* Add delay between transfers */
        delay_cycles(1000);
    
        /* Send a read request to Target */
        DL_I2C_startControllerTransfer(I2C_INST, I2C_TARGET_ADDRESS,
            DL_I2C_CONTROLLER_DIRECTION_RX, I2C_RX_PACKET_SIZE);

    Also make sure to mask out the CH bit.