Skip to content

Delays in socket.cpp within an active SPI transaction can cause watchdog triggering or unpredictable behaviour #282

Open
@Bascy

Description

@Bascy

On a number of locations in Socket.cpp there is a delayMicroseconds() added while an SPI transaction is active. This can happen when a goto makesocket is executed in the lines above.

This delay might cause a context switch and another task trying to start a SPI transaction with a max-delay. This can cause wacthdog timers to trigger.

I think we should remove the delays to avoid this, as they are already marked as "is this needed?"

line 103:

makesocket:
	//Serial.printf("W5000socket %d\n", s);
	EthernetServer::server_port[s] = 0;
	delayMicroseconds(250); // TODO: is this needed??
	W5100.writeSnMR(s, protocol);
	W5100.writeSnIR(s, 0xFF);

line 167:

makesocket:
	//Serial.printf("W5000socket %d\n", s);
	EthernetServer::server_port[s] = 0;
	delayMicroseconds(250); // TODO: is this needed??
	W5100.writeSnMR(s, protocol);
	W5100.writeSnIR(s, 0xFF);

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions