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.

MSP432E401Y: Seeking Support for Reading ROM code of I-Button

Part Number: MSP432E401Y


Tool/software:

Dear TI Team,

                     In our custom board, we are using the DS9092L+ IButton probe with the DS1971+F5 IButton interfaced with MSP432E4 Microcontroller. However, we are facing difficulties in reading the ROM code of the IButton.

Below are the connections for your reference:

  • IButton Probe:
    • Green (Data) connected to PORTE- E2 on the microcontroller
    • Black (+ve LED) connected to PORTE- E3 on the microcontroller
    • White (-ve LED) connected to GND
    • Red (Ground) connected to GND

Additionally, we have connected a 4.7kohm resistor for pull-up on the data line.

I have also given below my microcontroller program for your reference.

#include <stdint.h>

// Definitions for PE2 and PE3
#define DQ_PIN BIT2
#define LED_PIN BIT3
#define DQ_PORT GPIOE

void delay_us(uint32_t us) {
// Delay function for microseconds (approximate)
uint32_t i;
for ( i = 0; i < (us * 3); i++) {
__NOP();
}
}


// 1-Wire reset function
void one_wire_reset() {

DQ_PORT->DIR |= DQ_PIN; // Set PE2 as output
DQ_PORT->DATA &= ~DQ_PIN; // Pull PE2 low
delay_us(480); // Delay 480 us
delayus(usecs);
DQ_PORT->DIR &= ~DQ_PIN; // Set PE2 as input
delay_us(70); // Delay 70 us
if (DQ_PORT->DATA & DQ_PIN) {
// No presence pulse detected
DQ_PORT->DATA &= ~LED_PIN; // Turn off LED
UARTprintf("No IButton detected.\n");
} else {
// Presence pulse detected
DQ_PORT->DATA |= LED_PIN; // Turn on LED
UARTprintf("IButton detected.\n");

}
delay_us(410); // Delay 410 us
}

// 1-Wire read bit function
uint8_t one_wire_read_bit() {
uint8_t bit = 0;
DQ_PORT->DIR |= DQ_PIN; // Set PE2 as output
DQ_PORT->DATA &= ~DQ_PIN; // Pull PE2 low
delay_us(6); // Delay 6 us
DQ_PORT->DIR &= ~DQ_PIN; // Set PE2 as input
delay_us(9); // Delay 9 us
bit = (DQ_PORT->DATA & DQ_PIN) ? 1 : 0; // Read bit
delay_us(55); // Delay 55 us
return bit;
}

// 1-Wire write bit function
void one_wire_write_bit(uint8_t bit) {
DQ_PORT->DIR |= DQ_PIN; // Set PE2 as output
DQ_PORT->DATA &= ~DQ_PIN; // Pull PE2 low
if (bit) {
delay_us(6); // Delay 6 us
DQ_PORT->DIR &= ~DQ_PIN; // Set PE2 as input
delay_us(64); // Delay 64 us
} else {
delay_us(60); // Delay 60 us
DQ_PORT->DIR &= ~DQ_PIN; // Set PE2 as input
delay_us(10); // Delay 10 us
}
}

// 1-Wire read byte function
uint8_t one_wire_read_byte() {
uint8_t i;
uint8_t byte = 0;
for (i = 0; i < 8; i++) {
byte |= (one_wire_read_bit() << i);
}
return byte;
}

// 1-Wire write byte function
void one_wire_write_byte(uint8_t byte) {
uint8_t i;
for ( i = 0; i < 8; i++) {
one_wire_write_bit(byte & (1 << i));
}
}

// Function to read the ROM code of the IButton
void read_rom(uint8_t *rom_code) {
uint8_t i;
one_wire_reset();
one_wire_write_byte(0x33); // Read ROM command

for ( i = 0; i < 8; i++) {
rom_code[i] = one_wire_read_byte();
UARTprintf("D[%d]:%x\n",i,rom_code[i]);
}
}


void main()
{

// Enable clock for Port E
SYSCTL->RCGCGPIO |= SYSCTL_RCGCGPIO_R4;


// Wait for Port E to be ready
while ((SYSCTL->PRGPIO & SYSCTL_PRGPIO_R4) == 0) {}


// Configure PE2 as bidirectional for 1-Wire (input/output)
DQ_PORT->DIR &= ~DQ_PIN; // Set PE2 as input initially
DQ_PORT->DEN |= DQ_PIN; // Enable digital function for PE2

// Configure PE3 as output for LED
DQ_PORT->DIR |= LED_PIN; // Set PE3 as output
DQ_PORT->DEN |= LED_PIN; // Enable digital function for PE3

read_rom(rom_code);

int i;
for (i=0;i<8;i++)
{
UARTprintf("D[%d]:%x\n",i,rom_code[i]);
}

// Main loop (could be used to continuously read data or handle other tasks)
while (1) {
// Your main application code
}

}

Kindly assist us in resolving this issue at your earliest convenience so that we can successfully read the ROM code of the IButton.

Thank you.

  • Hi,

      I have no knowledge of DS9092L+ and DS1971+F5. I will suggest you take a capture of PE2 and PE3 signals and show to the iButton support team. Do you know if your PE2 and PE3 have the correct waveforms? If you believe the PE2 and PE3 is produced correctly then iButton can help you debug their products. They can also comment if your PE2 and PE3 signals are correct as far as timing is concerned. There is nothing I can suggest as I have no idea how their one wire product works and what is the protocol for communicating with the ROM. 

  • Dear Charles,

                        Thank you for your reply. As you suggested, I contacted the I-Button link team regarding my queries.

                         I have one more question: I am working with the MSP430F5529IPN microcontroller. Which SDK do I need to download for Ethernet and other examples? I installed the MSP430 SDK, but it is not showing any examples in the CCS Resource Explorer. If you could provide a link, that would be very helpful.

    Thank you in advance.

  •  I have one more question: I am working with the MSP430F5529IPN microcontroller.

    Hi,

      Sorry, your post is routed to MSP432E support team. I have no experience with MSP430F5529IPN. Can you please open a new post with the part number for MSP430F5529IPN so the post will be routed to the proper support team for best assistance.