Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add register API #15

Merged
merged 26 commits into from
Sep 28, 2022
Merged

Add register API #15

merged 26 commits into from
Sep 28, 2022

Conversation

generationmake
Copy link
Contributor

No description provided.

@generationmake
Copy link
Contributor Author

now compiling after https://github.com/107-systems/107-Arduino-Cyphal was fixed.

@generationmake
Copy link
Contributor Author

hi @aentinger
could you please check this.
this should create a register list. maybe not in the best possible way but it should do it.

Nevertheless it is not working:

pi@raspberrypi:~ $ y -i 'CAN(can.media.socketcan.SocketCANMedia("can0",8),59)' rl 99 
Register list service is not accessible at node 99
null

any ideas?
Thanks.

@aentinger
Copy link
Member

Nothing comes to mind immediately. Possibly there could be something in the OpenCyphal Specification about what we are missing?

Also try and check the return value of respond:

  if (!node_hdl.respond(rsp, transfer.metadata.remote_node_id, transfer.metadata.transfer_id))
    Serial.println("respond failed");

@pavel-kirienko which error conditions would trigger the yakut output listed above?

@generationmake
Copy link
Contributor Author

@aentinger
were you able to take a look at this or do some tests one your own?

@aentinger
Copy link
Member

@aentinger were you able to take a look at this or do some tests one your own?

Not yet, I'm trying to clean out the l3xz_io software first 🙇 .

@aentinger aentinger changed the title add register access Add register API Aug 26, 2022
@aentinger
Copy link
Member

Good Morning @generationmake ☕ 👋

I think I've fixed the register access issue. Can you please test?

Can you please also document the yakut commands you use for testing?

Note: I've been running a OpenCyphal network with 7 nodes and 1MBit/s + shoddy wiring on L3XZ and there are no problems (on the reception side). Also no glaring error was found during review of the service logic within 107-Arduino-Cyphal.

@generationmake
Copy link
Contributor Author

Hi @aentinger
I have tested with your latest software again and it is still not working!
the yakut command is:
y -i 'CAN(can.media.socketcan.SocketCANMedia("can0",8),59)' rl 99
the response is still

Register list service is not accessible at node 99
null

@generationmake
Copy link
Contributor Author

could there be a conflict with the latest MCP2515 driver and that no more receive interrupts are generated?

@aentinger
Copy link
Member

could there be a conflict with the latest MCP2515 driver and that no more receive interrupts are generated?

I've just re-checked, that should not be the case. Can you possibly test with a version prior that change, i.e. v1.3.4?

@generationmake
Copy link
Contributor Author

Hi @aentinger
I have checked with the previous and it also does not work. It seems like no interrupts are generated and no CAN messages are received by the controller. Serial output also shows nothing.
Have you checked with your board?

@pavel-kirienko
Copy link
Member

the yakut command is:

Protip: put this into l_drei_xz_slcan.sh:

# If no slcan ifaces exist in the system, try configuring them automatically
# using all connected Zubax Babel units.
if ! [ -e /sys/class/net/slcan0 ]; then
    # https://gist.github.com/pavel-kirienko/32e395683e8b7f49e71413aebf5e1a89
    sudo setup_slcan -r /dev/serial/by-id/usb-Zubax*Babel*
fi

# Set up the Cyphal/CAN configuration registers depending on which ifaces are up.
export UAVCAN__CAN__IFACE='socketcan:slcan0'
if [ -e /sys/class/net/slcan1 ]; then
    export UAVCAN__CAN__IFACE="$UAVCAN__CAN__IFACE socketcan:slcan1"
fi
export UAVCAN__CAN__MTU=8
export UAVCAN__CAN__BITRATE='1000000 1000000'

# Automatically find a free node-ID for all commands run in this session.
export UAVCAN__NODE__ID=$(yakut accommodate)
echo "Auto-selected node-ID for this session: $UAVCAN__NODE__ID"

Then use it like this:

source l_drei_xz_slcan.sh  # Do this once per terminal session.
y rl 99                    # Then just use Yakut as thou wilt.

@aentinger
Copy link
Member

aentinger commented Sep 7, 2022

Have you checked with your board?

I'll check 👍

Thank you @pavel-kirienko for the pro-tip 😉

@aentinger
Copy link
Member

Hi @generationmake ☕ 👋

I've broken my OpenCyphalPicoBase board 😢 . It never exposed a tty and now even via pressing BOOTSEL on power-up I can't restore the backup-upload mechanism via file storage.

Meanwhile, can you give a try to the register list command using a modified MCP2515 driver (see here 107-systems/107-Arduino-MCP2515#65 )? 🙏

@aentinger
Copy link
Member

I've debugged the issue and I'm now reasonably sure the problem (amongst other ones, already solved ones: 107-systems/107-Arduino-MCP2515#66, 107-systems/107-Arduino-MCP2515#65) stems from the MCP2515 receive interrupt not being triggered anymore after a couple of CAN frames have been received (see 107-systems/107-Arduino-MCP2515#62, 107-systems/107-Arduino-MCP2515#53). I will need to continue looking into it.

@aentinger
Copy link
Member

Hi @generationmake ☕ 👋

I believe I fixed your problem (e93a8c0). At least I can say with confidence that if fixed the same issue over here 107-systems/107-Arduino-Cyphal#158 .

@generationmake
Copy link
Contributor Author

Hi @aentinger
I did a short test and every thing seems to work now. Thanks for the good work!
I will test harder and add some more registers and see how it performs.

@generationmake
Copy link
Contributor Author

Hi @aentinger
I think I made one subject-id-register writable and it seems to work.
Unfortunately the 107-Arduino-Cyphal library does not support dynamic Subject-IDs.
Do you have any idea how to proceed?
Thanks.

@aentinger
Copy link
Member

Unfortunately the 107-Arduino-Cyphal library does not support dynamic Subject-IDs.
Do you have any idea how to proceed?

I have, but its the next step on the roadmap - after register API. See my comment here.

@generationmake
Copy link
Contributor Author

Hi @aentinger
I added registers to configure the update interval of the publish subject-ids.
And I tried to set a lower limit of 100 on them:
https://github.com/107-systems/l3xz-fw_aux-controller/blob/2fe74158ea5434129010a8b93c0c87f5dfbda7c3/l3xz-fw_aux-controller.ino#L214

The code works as expected and the limit is correctly set. However the Cyphal register value is not set correctly.

bernhard@notebookR60P-22:~$ y r -dd 99 aux.updateinterval.input0
natural16:                        
  value: [500]
_meta_: {mutable: true, persistent: false}
bernhard@notebookR60P-22:~$ y r -dd 99 aux.updateinterval.input0 5
natural16:                        
  value: [5]
_meta_: {mutable: true, persistent: false}
bernhard@notebookR60P-22:~$ y r -dd 99 aux.updateinterval.input0
natural16:                        
  value: [5]
_meta_: {mutable: true, persistent: false}

could you please check this? The value of the register should be 100.

Thanks

@aentinger
Copy link
Member

You were in fact abusing the register-api in a way it was not designed 😝 . I've built a limit-functionality just for you and already pushed the changes to this fork.

@generationmake
Copy link
Contributor Author

registers are implemented. code works as expected.
will merge.

@generationmake generationmake merged commit 000fec2 into main Sep 28, 2022
@generationmake generationmake deleted the register branch September 28, 2022 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants