问题
I use TIOL111 IO-Link device transceiver.
I have written the initial part of a communication protocol with M-sequence type 0, but Master several times send sonly two request (with address 0x02 and 0x03). All responses are correct. When I connect Balluff I/O Module (BNI IOL-...) master sends messages with addresses in turn 0x02 0x03 0x04 0x05 0x06 ..., but when I connect my device up to same port, it is sending only the first two. I use TIOL111 IO-Link device transceiver.
Does somebody know this communication protocol and can help me?
void iol_operate()
{
if (uart_rx_available() > 0)
{
OctetMC = uart_get();
while (uart_rx_available() == 0) {}
if (iol_checksum_compression(0x52 ^ OctetMC) != (uart_peek() & 0b00111111)) return;
OctetCKT = uart_get();
ReadWrite = (OctetMC >> 7) & 0b1;
CommunicationChannel = (OctetMC >> 5) & 0b11;
Address = OctetMC & 0b11111;
MSeqType = (OctetCKT >> 6) & 0b11;
Checksum = OctetMC ^ OctetCKT;
switch (MSeqType)
{
case 0: iol_m_sequence_type_0();
break;
case 1: iol_m_sequence_type_1();
break;
case 2: iol_m_sequence_type_2();
break;
}
OctetCKS = iol_checksum_compression(Checksum) | (ProcessDataStatus << 6) | (EventFlag << 7);
uart_put(OctetCKS);
iol_set_en_out();
iol_default_variables();
}
}
void iol_m_sequence_type_0()
{
if (ReadWrite) // READ
{
switch (Address)
{
case 0x02: OctetOD = MIN_CYCLE_TIME;
break;
case 0x03: OctetOD = (M_SEQ_SETTING_PREOPERATE << 4) | (M_SEQ_SETTING_OPERATE << 1) | ISDU_SUPPORT;
break;
case 0x04: OctetOD = IOL_REV;
break;
case 0x05: OctetOD = (PROCESS_DATA_IN_BYTE << 7) | (SIO_SUPPORT << 6) | PROCESS_DATA_IN_LENGTH;
break;
case 0x06: OctetOD = (PROCESS_DATA_OUT_BYTE << 7) | PROCESS_DATA_OUT_LENGTH;
break;
case 0x07: OctetOD = (VID >> 8) & 0xFF;
break;
case 0x08: OctetOD = VID & 0xFF;
break;
case 0x09: OctetOD = (DID >> 16) & 0xFF;
break;
case 0x0A: OctetOD = (DID >> 8) & 0xFF;
break;
case 0x0B: OctetOD = DID & 0xFF;
break;
default: // Complete the code
break;
}
Checksum ^= OctetOD;
_delay_ms(1);
EN_OUT;
uart_put(OctetOD);
}
else // WRITE
{
while (uart_rx_available() == 0) {}
OctetOD = uart_get();
Checksum ^= OctetOD;
switch (OctetOD)
{
// Complete the code
}
EN_OUT;
}
}
void iol_set_en_out()
{
while (uart_tx_available() != 0) {}
_delay_ms(5);
EN_IN;
uart_flush();
_delay_ms(1);
}
I corrected this question: IO-Link master sending only two M-sequence octet
来源:https://stackoverflow.com/questions/59730555/corrected-io-link-master-sending-only-two-m-sequence-octet