SBL2e Custom packetization

Discussion to talk about software related topics only.
Post Reply
Majormajor0
Posts: 5
Joined: Mon Nov 01, 2021 4:56 pm

SBL2e Custom packetization

Post by Majormajor0 »

I am using the SBL2e out of the box and making settings through the web interface / index page on the card itself.
I am using the card to send visca commands, which terminate in 0xff (255), and I would like to flush the TCP frame on this character.
The web interface only allows the flush character to go up to 254, and NA's it if I enter 255. I assume this has something to do with telnet.

Is there a workaround for this?

The timeout is not a great solution, because it introduces long unnecessary delays on short commands.
Counting characters is not a great solution, because the commands are of very different lengths and it will revert to the timeout the great majority of the time.
User avatar
TomNB
Posts: 538
Joined: Tue May 10, 2016 8:22 am

Re: SBL2e Custom packetization

Post by TomNB »

Checked with engineering on this. A value needed to be selected to determine if any value has been set, and that value is 0xff. So if you turn on packetization, and do not select any value, I have been told 0xff will be the flush value.
User avatar
pbreed
Posts: 1080
Joined: Thu Apr 24, 2008 3:58 pm

Re: SBL2e Custom packetization

Post by pbreed »

The SBL2E is really really tight on RAM, so we make the FLUSH_CHAR ==0xFF for off...
so we did not have to store both a char and a flag....

Alas in the operational serial pump code we check for custom packetization, but don't check for Flush=FF so.....
if you select custom, but no flush, it flushes on FF anyway :-(

if you want it to flush on FF, just turn custom packetization ON and
indicate no flush_char....

Not our best bit of coding, but should fix your issue...
Majormajor0
Posts: 5
Joined: Mon Nov 01, 2021 4:56 pm

Re: SBL2e Custom packetization

Post by Majormajor0 »

pbreed and TomNB,

Thanks for looking at this.
The unit does not seem to flush on 0xff with the flush character set to NA.

FWIW I have SBL2E v1.67 Nov 29 2016. Settings are below.

Here is what I did.
1. Reset to factory defaults from the configuration web page
2. Select custom packetization 50, 100, NA. (did not edit any box, just set checkbox)
3. Click submit new settings
4. Sent 0x81 0x21 0xff on the IP side (expected response: 0x90 0x61 0x04 0xff)
5. Response is 0x90 0x61 0x04 0xff. Takes 100+ ms (clearly timing out and flushing at 100 ms).
6. Set flush character to 4 (==0x04)
7. Sent 0x81 0x21 0xff
8. Response is 0x90 0x61 0x04. Takes 2+ ms (clearly flushing on 0x04).


settings.JPG
settings.JPG (133.72 KiB) Viewed 2472 times
Majormajor0
Posts: 5
Joined: Mon Nov 01, 2021 4:56 pm

Re: SBL2e Custom packetization

Post by Majormajor0 »

It doesn't look like there will be any progress on this.
So, if I get a development kit, will I have access to the factory source code to edit this feature, or would I be stuck developing from scratch?
What would be the minimum development kit I need?
User avatar
pbreed
Posts: 1080
Joined: Thu Apr 24, 2008 3:58 pm

Re: SBL2e Custom packetization

Post by pbreed »

Are you a C/C++ dev?
If not this is going to be really hard...
If so I'll PM you a dev key code Tuesday.
(Shipping/Packing has gone home for the day and they have the list of unissued dev keys.)

Looking at the code:
FlushChar defaults to 0xFF.... so
I don't for the life of me understand why it does not work.

This is deep down in the core code:

if ( Ram_Config.sp_cfg[ser].bCustomPackets )
{
Serial2TcpBuf[ser].accum++;

if ( c == Ram_Config.sp_cfg[ser].FlushChar )
{
bSendNow[ser] = true;
}

if ( Serial2TcpBuf[ser].accum >= Ram_Config.sp_cfg[ser].Num_Accum )
{
bSendNow[ser] = true;
}

if ( !TimeoutCount[ser] )
{
TimeoutCount[ser] = Ram_Config.sp_cfg[ser].Num_Msec_to_Wait;
}
}
Majormajor0
Posts: 5
Joined: Mon Nov 01, 2021 4:56 pm

Re: SBL2e Custom packetization

Post by Majormajor0 »

Yes, I can do embedded development in c/c++.
I believe you that it should work--that's why I posted what I actually did, rather than insisting on my conclusions--in case there is a flaw in my logic.

IIRC, there is a much newer version of the firmware than the version on my board. It would be delightful if flashing the latest would fix this problem.

If you can give me a key, that would be fantastic. Also, please point me to the hardware I need to acquire to flash and debug this board.
User avatar
TomNB
Posts: 538
Joined: Tue May 10, 2016 8:22 am

Re: SBL2e Custom packetization

Post by TomNB »

Hello,

We can't post a key to a public forum. If you can please email sales@netburner.com with a reference to this ticket we can proceed from there.
Majormajor0
Posts: 5
Joined: Mon Nov 01, 2021 4:56 pm

Re: SBL2e Custom packetization

Post by Majormajor0 »

The bug (probably not a bug at all) is in

\nburn\examples\SBL2E\dualserial\serial_pump.cpp
void Incommingchar( char c, int ser )
line 1367

Code: Select all

 
// This is the original. This does not flush
if ( c == Ram_Config.sp_cfg[ser].FlushChar ) // Flush char set to 0xff
{
    bSendNow[ser] = true;
}

// This also does not flush
if ( c == 0xff)
{
    bSendNow[ser] = true;
}

// This flushes on 0xff
if ( c == -1)
{
    bSendNow[ser] = true;
}
There is a type safety issue somewhere.
This may be on purpose. It seems like having the buffer flush on 255 when the web interface is displaying NA would be unexpected behavior. So it is probably best as is and 255 is just not available.

I don't need to troubleshoot any further, because hard coding this works for my purpose.

Thanks again.
Post Reply