Page 1 of 1

SetSchedule returns errWrongParameterValue

Posted: Mon 26. Sep 2022, 10:53
by sdelling
Hello,

I try to configure a Scheduling table for my PLin USB in C++ but cannot quite figure out what I am doing wrong:

Code: Select all

TLINScheduleSlot schedule[3];

schedule[0].Delay = 10;
schedule[0].FrameId[0] = 0x1E;
schedule[0].Type = sltUnconditional;
 
schedule[1].Delay = 20;
schedule[1].FrameId[0] = 0x20;
schedule[1].Type = sltUnconditional;

schedule[2].Delay = 10;
schedule[2].FrameId[0] = 0x20;
schedule[2].Type = sltUnconditional;

mApi.SetSchedule(mClientId, mHwId, 0, &schedule[0], 3);
mApi is an instance of the PLinApiClass.

Before I have done this:

Code: Select all

mApi.GetAvailableHardware(buf, sizeof(buf), &realCount);

mHwId = buf[0];
mApi.RegisterClient("HvLin", 0, &mClientId);

mApi.ConnectClient(mClientId, mHwId);
mApi.InitializeHardware(mClientId, mHwId, 2, 19200);

Re: SetSchedule returns errWrongParameterValue

Posted: Mon 26. Sep 2022, 13:32
by sdelling
I think I should register the frames before scheduling but the result is the same:

Code: Select all

TLINFrameEntry fe;
fe.ChecksumType = cstEnhanced;
fe.Direction = dirPublisher;
fe.FrameId = 0x1E;
fe.Length = 8;
BYTE data[8] = {0x00, 0x00, 0xF8, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF};
std::memcpy(&fe.InitialData[0], &data[0], 8);
mApi.SetFrameEntry(mClientId, mHwId, &fe);

TLINFrameEntry fe2;
fe2.ChecksumType = cstEnhanced;
fe2.Direction = dirSubscriber;
fe2.FrameId = 0x20;
fe2.Length = 8;
mApi.SetFrameEntry(mClientId, mHwId, &fe2);

Re: SetSchedule returns errWrongParameterValue

Posted: Fri 7. Oct 2022, 13:36
by M.Riedl
Hello,

I think you forgot to initialize all struct values of the slots (TLINScheduleSlot).
You can just do it also like this:

Code: Select all

TLINScheduleSlot schedule[3] = { 0 };
Regards
M.Riedl

Re: SetSchedule returns errWrongParameterValue

Posted: Tue 11. Oct 2022, 10:19
by sdelling
Hello,

I already suspected that it was something stupid on my side :) . Now it works.

Thanks!