SOME/IP in AUTOSAR Classic

SOME/IP

Initial Wait, Repetition and Main Phase

When a service instance becomes available, the server does not send its OfferService at one fixed pace. It first waits a little, then repeats the offer quickly with growing gaps, then settles into a slow, steady rhythm: three phases, each with its own timing.

Wait, repeat, settle

Timing diagram over 12 seconds. Initial Wait Phase from 0 to 1 second, first OfferService at 1 second. Repetition Phase: OfferService at 1.5, 2.5 and 4.5 seconds, gaps doubling 0.5, 1 and 2 seconds. Main Phase from 4.5 seconds: OfferService every 2 seconds at 6.5, 8.5 and 10.5. Initial Wait Phase Repetition Phase Main Phase OfferService 0.5 1 2 s 2 s 2 s random 0 s12 s
Figure 1. Read the gaps under the dots: 0.5, 1, 2 seconds in the Repetition Phase (each gap doubles), then a steady 2 seconds in the Main Phase. The first OfferService comes after a random wait. Values are an example.

phase 1

Initial Wait Phase

The Initial Wait Phase (a random wait before the first message) lasts between INITIAL_DELAY_MIN and INITIAL_DELAY_MAX; then the first OfferService goes out. Many ECUs start together after power-up; the random wait spreads their messages out, and gives Sd time to collect several entries into one SD message.

phase 2

Repetition Phase

In the Repetition Phase (quick repeats with doubling gaps) the server offers again after REPETITIONS_BASE_DELAY (the first gap), then after twice that, four times that, and so on, REPETITIONS_MAX times (the number of repeats). Clients that start a bit later find the service instance very fast, without flooding the network.

phase 3

Main Phase

In the Main Phase (the steady last phase) the server offers every CYCLIC_OFFER_DELAY (the period) for as long as the service instance is available. With CYCLIC_OFFER_DELAY = 0, no more offers are sent in this phase.

With REPETITIONS_MAX = 0 the Repetition Phase is skipped: the first OfferService is followed directly by the Main Phase.

FindService during the phases

A client may send a FindService (the client's question "who offers this service?", lesson 13) while the server is in one of these phases.

PhaseA FindService arrives
Initial Wait PhaseIgnored. The first OfferService is coming anyway.
Repetition PhaseAnswered with an extra OfferService. The repetition counter and the running gap are not touched.
Main PhaseAnswered with an OfferService, normally by unicast to the client that asked.

An answer to a multicast FindService is sent after REQUEST_RESPONSE_DELAY (a random wait between a minimum and a maximum), so that a busy network is not flooded with simultaneous answers. Lesson 13 shows this delay from the client's side.

Going back to the start

If the service instance stops being available, the server sends a StopOfferService (unless it was still in the Initial Wait Phase) and leaves the phases. If the ECU loses its IP address, for example because the link went down, the phases also end; when the address comes back, the server starts again with the Initial Wait Phase.

Try it

Choose the settings and press "Start". The Phase lane shows the Initial Wait Phase in grey, the Repetition Phase in pink and the Main Phase in green. Use "Send FindService" during each phase to see the different reactions.

Things to notice. A FindService in the Initial Wait Phase gets no answer of its own; one in the Repetition Phase gets an extra OfferService, but the next regular offer stays where it was. With CYCLIC_OFFER_DELAY 0 the server falls silent after the repetitions; clients then rely on a long TTL and on FindService.

Check yourself optional

New terms in this lesson

TermMeaning
Initial Wait PhaseRandom wait before the first OfferService
INITIAL_DELAY_MIN, INITIAL_DELAY_MAXBounds of that random wait
Repetition PhaseQuick repeats of the offer, each gap twice the one before
REPETITIONS_BASE_DELAYThe first gap of the Repetition Phase
REPETITIONS_MAXNumber of repeats; 0 skips the phase
Main PhaseSteady offers for as long as the service instance is available
CYCLIC_OFFER_DELAYPeriod of the offers in the Main Phase; 0 means none
REQUEST_RESPONSE_DELAYRandom wait (min, max) before answering a multicast FindService

Source: SOME/IP-SD Protocol Specification, R20-11, sections 4.1.4.1, 4.1.4.2, 4.1.4.3 and 4.1.4.5; Service Discovery, R20-11, section 7.6 (where the protocol text is ambiguous about the first offer of the main phase, the course follows the module specification: one interval after the main phase starts).