stm32-async-1wire 3.2.0
Non-blocking 1-Wire master for STM32 with DS18B20 temperature and DS2431 EEPROM drivers
Loading...
Searching...
No Matches
DS2431 Exported Constants

Macros

#define DS2431_FAMILY_CODE   0x2D
 DS2431 1-Wire family code (LSB of the 64-bit ROM address).
#define DS2431_BITS_PER_BYTE   8
 Standard 8 bits per byte.
#define DS2431_ROM_BYTES   8
 Number of bytes in a device ROM address.
#define DS2431_EEPROM_SIZE   128
 DS2431 EEPROM size in bytes (1 kbit).
#define DS2431_PAGE_SIZE   32
 DS2431 EEPROM page size in bytes (4 pages of 32 bytes).
#define DS2431_PAGE_COUNT   (DS2431_EEPROM_SIZE / DS2431_PAGE_SIZE)
 Number of EEPROM pages.
#define DS2431_SCRATCH_SIZE   8
 DS2431 scratchpad size in bytes (one EEPROM block).
#define DS2431_SCRATCH_FRAME   (DS2431_SCRATCH_SIZE + 3)
 Maximum length of the Read Scratchpad reply frame in bytes.
#define DS2431_SCRATCH_FRAME_CRC   (DS2431_SCRATCH_FRAME + 2)
 Maximum wire length of the Read Scratchpad reply in bytes, CRC included.
#define DS2431_READ_MEMORY   0xF0
 DS2431 Read Memory command.
#define DS2431_WRITE_SCRATCHPAD   0x0F
 DS2431 Write Scratchpad command.
#define DS2431_READ_SCRATCHPAD   0xAA
 DS2431 Read Scratchpad command.
#define DS2431_COPY_SCRATCHPAD   0x55
 DS2431 Copy Scratchpad command.
#define DS2431_MATCH_ROM   0x55
 DS2431 Match ROM command (ROM-level addressing prefix).
#define DS2431_SKIP_ROM   0xCC
 DS2431 Skip ROM command (ROM-level broadcast prefix).
#define DS2431_TPROG_US   11000
 Copy Scratchpad EEPROM programming hold-off in microseconds.
#define DS2431_READ_PASS   8
 Maximum EEPROM bytes read by one Read Memory bus transaction.

Detailed Description

Macro Definition Documentation

◆ DS2431_BITS_PER_BYTE

#define DS2431_BITS_PER_BYTE   8

Standard 8 bits per byte.

◆ DS2431_COPY_SCRATCHPAD

#define DS2431_COPY_SCRATCHPAD   0x55

DS2431 Copy Scratchpad command.

Note
Copies the scratchpad into the matching EEPROM block. The EEPROM programming (t_PROG, 10ms max) writes one block in about 11ms; the driver waits DS2431_TPROG_US, engages the strong pull-up for the whole window in parasite mode, then reads the device's completion pattern: 0xAA means the block was programmed, logic 1 means the device refused the copy (PF set, invalid address or copy-protected page) and the driver reports failure.
Takes the same byte value (0x55) as the 1-Wire Match ROM ROM-level command; the two never collide because the ROM-level command phase completes before a device-level command is issued.

◆ DS2431_EEPROM_SIZE

#define DS2431_EEPROM_SIZE   128

DS2431 EEPROM size in bytes (1 kbit).

◆ DS2431_FAMILY_CODE

#define DS2431_FAMILY_CODE   0x2D

DS2431 1-Wire family code (LSB of the 64-bit ROM address).

Note
Other 1-Wire devices on the bus use different family codes and are skipped by a family-filtered device search.

◆ DS2431_MATCH_ROM

#define DS2431_MATCH_ROM   0x55

DS2431 Match ROM command (ROM-level addressing prefix).

Note
Shares its byte value with DS2431_COPY_SCRATCHPAD; see there.

◆ DS2431_PAGE_COUNT

#define DS2431_PAGE_COUNT   (DS2431_EEPROM_SIZE / DS2431_PAGE_SIZE)

Number of EEPROM pages.

◆ DS2431_PAGE_SIZE

#define DS2431_PAGE_SIZE   32

DS2431 EEPROM page size in bytes (4 pages of 32 bytes).

◆ DS2431_READ_MEMORY

#define DS2431_READ_MEMORY   0xF0

DS2431 Read Memory command.

Note
Reads memory starting at the address given by the TA1/TA2 argument; the read must stay within EEPROM_SIZE and the driver caps one read pass at DS2431_READ_PASS bytes (the proven Linux driver chunk size).

◆ DS2431_READ_PASS

#define DS2431_READ_PASS   8

Maximum EEPROM bytes read by one Read Memory bus transaction.

Note
1-Wire reads are captured one bit slot per pulse; capping the pass keeps the capture buffer small (kernel-proven 8-byte chunk). Large reads are looped by the application in DS2431_READ_PASS-byte passes.

◆ DS2431_READ_SCRATCHPAD

#define DS2431_READ_SCRATCHPAD   0xAA

DS2431 Read Scratchpad command.

Note
Returns the frame TA1, TA2, ES followed by (E[2:0] - T[2:0] + 1) scratchpad data bytes. On the bus the reply continues with an inverted CRC-16 over the command (0xAA), TA1, TA2, ES and those data bytes; the driver clocks the maximum window (DS2431_SCRATCH_FRAME_CRC) and verifies the CRC with onewire_crc16() over the bytes the device actually transmitted. The TA/ES echo is additionally compared against what the last Write Scratchpad latched, the PF flag (0x20, set when the device received fewer bytes than the scratchpad holds) is rejected, and the read-back data bytes are compared with the payload that was sent, so a write corrupted in flight is not reported as successful.

◆ DS2431_ROM_BYTES

#define DS2431_ROM_BYTES   8

Number of bytes in a device ROM address.

◆ DS2431_SCRATCH_FRAME

#define DS2431_SCRATCH_FRAME   (DS2431_SCRATCH_SIZE + 3)

Maximum length of the Read Scratchpad reply frame in bytes.

Note
3-byte header (TA1, TA2, ES) + up to 8 scratchpad bytes. The device returns (E[2:0] - T[2:0] + 1) data bytes, so the reply is only DS2431_SCRATCH_FRAME long for a full 8-byte window; ds2431_read_scratchpad() zero-fills the unused tail and the caller reads the real length from the E/S byte.

◆ DS2431_SCRATCH_FRAME_CRC

#define DS2431_SCRATCH_FRAME_CRC   (DS2431_SCRATCH_FRAME + 2)

Maximum wire length of the Read Scratchpad reply in bytes, CRC included.

Note
The (up to 11-byte) frame (DS2431_SCRATCH_FRAME) followed by the two inverted CRC-16 bytes the device transmits (datasheet Read Scratchpad [AAh]). The driver always clocks this many slots - the device drives logic 1 once it has finished transmitting - and verifies the CRC over the (E[2:0] - T[2:0] + 1) bytes that were actually sent; the valid frame is returned to the caller.

◆ DS2431_SCRATCH_SIZE

#define DS2431_SCRATCH_SIZE   8

DS2431 scratchpad size in bytes (one EEPROM block).

Note
The EEPROM is programmed in 8-byte blocks, so write cycles must start at an 8-byte-aligned address and write up to 8 bytes.

◆ DS2431_SKIP_ROM

#define DS2431_SKIP_ROM   0xCC

DS2431 Skip ROM command (ROM-level broadcast prefix).

◆ DS2431_TPROG_US

#define DS2431_TPROG_US   11000

Copy Scratchpad EEPROM programming hold-off in microseconds.

Note
DS2431 datasheet t_PROG: 10ms max; the driver waits 11ms (the value proven by the Linux driver) to absorb the maximum with headroom.

◆ DS2431_WRITE_SCRATCHPAD

#define DS2431_WRITE_SCRATCHPAD   0x0F

DS2431 Write Scratchpad command.

Note
Writes up to 8 bytes into the volatile scratchpad and latches the target address with the end-offset status byte ES. Does not touch the EEPROM; it takes effect on Copy Scratchpad (DS2431_COPY_SCRATCHPAD).