Skip to content
This repository has been archived by the owner on Oct 1, 2021. It is now read-only.

Add a system command for writing/viewing OTP, see docs below... #42

Open
wants to merge 177 commits into
base: master
Choose a base branch
from

Conversation

bugobliterator
Copy link
Member

nsh> otp
otp: usage:
otp show - show all block contents and lock bitsotp write  <32 hex bytes, LSB first, no spaces>  - will print values after readback
otp read  - will print 32 bytes readback from block (and the current CRC)
otp lock   - will permanently lock the specified block number

nsh> otp show
 0: L 5058340000ac26000010000000ffffffffffffffffffffffffffffffffffffff 55393c7b
 1: L 3296c91156c6a2cd9d472bd768e74ad9c731d43b9180a994f9b927517e41425a e50fcf15
 2: L 5207fe5842dd9bcd27f2077759ca977292334e8c366969f3797efaaa6940ad00 26df18c8
 3: L c0190f185410e5fd13dce5b37b8f8030ab84e1fa1c026088eb1ee4b224fb662b ae616df5
 4: L a800a8110a956c55fe43698fa584e9a1d7f8b10495e3460c1de681c0c7b89875 3245288a
 5: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 6: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 7: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 8: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 9: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
10: U 5058340000002600001000000000000000000000000000000000000000000000 2fab057d
11: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
12: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
13: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
14: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
15: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6

nsh> otp write 10 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
otp: Write not accepted

nsh> otp write 10 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6�7
otp: CRC does not match bytes

nsh> otp write 11 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
WRITTEN

nsh> otp write 11 5058340000ac26000010000000ffffffffffffffffffffffffffffffffffffff 55393c7b
WRITTEN

nsh> otp show
 0: L 5058340000ac26000010000000ffffffffffffffffffffffffffffffffffffff 55393c7b
 1: L 3296c91156c6a2cd9d472bd768e74ad9c731d43b9180a994f9b927517e41425a e50fcf15
 2: L 5207fe5842dd9bcd27f2077759ca977292334e8c366969f3797efaaa6940ad00 26df18c8
 3: L c0190f185410e5fd13dce5b37b8f8030ab84e1fa1c026088eb1ee4b224fb662b ae616df5
 4: L a800a8110a956c55fe43698fa584e9a1d7f8b10495e3460c1de681c0c7b89875 3245288a
 5: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 6: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 7: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 8: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 9: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
10: U 5058340000002600001000000000000000000000000000000000000000000000 2fab057d
11: U 5058340000ac26000010000000ffffffffffffffffffffffffffffffffffffff 55393c7b
12: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
13: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
14: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
15: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6

nsh> otp lock 10
otp: Invalid arguments
otp: usage:
otp show - show all block contents and lock bitsotp write  <32 hex bytes, LSB first, no spaces>  - will print values after readback
otp read  - will print 32 bytes readback from block (and the current CRC)
otp lock   - will permanently lock the specified block number

nsh> otp lock 10 10
LOCKED

nsh> otp show
 0: L 5058340000ac26000010000000ffffffffffffffffffffffffffffffffffffff 55393c7b
 1: L 3296c91156c6a2cd9d472bd768e74ad9c731d43b9180a994f9b927517e41425a e50fcf15
 2: L 5207fe5842dd9bcd27f2077759ca977292334e8c366969f3797efaaa6940ad00 26df18c8
 3: L c0190f185410e5fd13dce5b37b8f8030ab84e1fa1c026088eb1ee4b224fb662b ae616df5
 4: L a800a8110a956c55fe43698fa584e9a1d7f8b10495e3460c1de681c0c7b89875 3245288a
 5: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 6: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 7: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 8: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 9: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
10: L 5058340000002600001000000000000000000000000000000000000000000000 2fab057d
11: U 5058340000ac26000010000000ffffffffffffffffffffffffffffffffffffff 55393c7b
12: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
13: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
14: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
15: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
nsh>

Andrew Tridgell and others added 30 commits November 26, 2014 08:48
If we check OUTPUTS_ARMED then we can't update trim values and scaling
in flight, as there is no way to clear OUTPUTS_ARMED.

If safety is on then it should be perfectly safe to update the mixer
and RC config or reboot for fw update
airspeed sensors often need to be on longer cables due to having to be
outside the prop wash.
the vehicle may not have setup a control_mode. We need to check the
return of orb_copy() to ensure we are getting initialised values
This merges in the PX4Flow changes from upstream
we were running out of file descriptors with the new battery monitoring
Add mpu6000 regdump command for debugging mpu6000.
this will catch both bad SPI bus comms and a sensor that has been
reset causing incorrect configuration.
this uses the same method as is now used in the MPU6000 to check that
the sensor retains its correct values
this mirrors the ardupilot driver. We have seen situations where the
mpu6000 on the Pixhawk comes up in SLEEP mode, despite a reset
this checks at runtime that key registers have correct values
this follows the factory calibration self-test method in the datasheet
to see if the sensor still has the same calibration it had in the factory
used to generate a error case for reset testing
this prevents the mpu6000 getting in a really weird state!
this may help automatic reset on the faulty boards
this seems to prevent a mpu6000 reset from causing an issue on the
l3gd20H
Gussy and others added 27 commits June 18, 2015 17:34
This was causing he LEDs to boot on every power cycle.
this makes it easier for a user to test that override is working
correctly in pre-flight checks. Otherwise override is hard to
distinguish from normal manual mode
if override is enabled then it should apply even if RAW_PWM is being
supplied by the FMU
this may well break the posix PX4 port. I'll talk to Mark about how to fix
perf counters are preferable to printf warnings
the key is splitting up read_reg() into two transfers
this prevents a mpu9250 being seen as a mpu6000
this is needed to prevent inadvertent camera trigger when setting up a
port
the PWM input driver is not the right place to have Lidar specific
code. It is intended to be a generic PWM input driver, and it should
not be touching other pins. Doing so prevents those pins from being
used for other purposes
on a V2 lidar we now use continuous mode, which avoids a bug where it
sometimes gives bad values for the distance (apparently reading from
the wrong register).

On both lidars we change the reset strategy to wait until we get all
of the required register values setup
this fixes perf output for nsh over MAVLink
While building PX4Firmware for ardupilot we see several messages like:

	make[1]: warning: jobserver unavailable: using -j1.  Add '+' to parent make rule.
	make[1]: Entering directory '/home/lucas/p/dronecode/ardupilot'

The problem is that we are recursing the makefiles by simply calling
make and we don't let Make keep track of the jobs.

There are some rules that need to be serialized, but they are not in
PX4Firmware, it's Ardupilot that needs to serialize some of the
recursive makes.
Fixes an exception we had been having when using sdlog2_dump.py
with dataflash logs:
        Exception: Unsupported format char: d in message GRAW (171)
this reduces self-heating of the sensor which reduces the amount of
altitude change when warming up. Apparently some individual sensors
are severely affected by this.

Unfortunately it raises the noise level, but Paul is confident it
won't be a significant issue
<pre>
nsh> otp
otp: usage:
otp show - show all block contents and lock bitsotp write <blocknum> <32 hex bytes, LSB first, no spaces> <crc32 for bytes> - will print values after readback
otp read <blocknum> - will print 32 bytes readback from block (and the current CRC)
otp lock <blocknum> <blocknum> - will permanently lock the specified block number

nsh> otp show
 0: L 5058340000ac26000010000000ffffffffffffffffffffffffffffffffffffff 55393c7b
 1: L 3296c91156c6a2cd9d472bd768e74ad9c731d43b9180a994f9b927517e41425a e50fcf15
 2: L 5207fe5842dd9bcd27f2077759ca977292334e8c366969f3797efaaa6940ad00 26df18c8
 3: L c0190f185410e5fd13dce5b37b8f8030ab84e1fa1c026088eb1ee4b224fb662b ae616df5
 4: L a800a8110a956c55fe43698fa584e9a1d7f8b10495e3460c1de681c0c7b89875 3245288a
 5: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 6: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 7: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 8: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 9: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
10: U 5058340000002600001000000000000000000000000000000000000000000000 2fab057d
11: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
12: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
13: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
14: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
15: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6

nsh> otp write 10 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
otp: Write not accepted

nsh> otp write 10 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6�7
otp: CRC does not match bytes

nsh> otp write 11 ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
WRITTEN

nsh> otp write 11 5058340000ac26000010000000ffffffffffffffffffffffffffffffffffffff 55393c7b
WRITTEN

nsh> otp show
 0: L 5058340000ac26000010000000ffffffffffffffffffffffffffffffffffffff 55393c7b
 1: L 3296c91156c6a2cd9d472bd768e74ad9c731d43b9180a994f9b927517e41425a e50fcf15
 2: L 5207fe5842dd9bcd27f2077759ca977292334e8c366969f3797efaaa6940ad00 26df18c8
 3: L c0190f185410e5fd13dce5b37b8f8030ab84e1fa1c026088eb1ee4b224fb662b ae616df5
 4: L a800a8110a956c55fe43698fa584e9a1d7f8b10495e3460c1de681c0c7b89875 3245288a
 5: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 6: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 7: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 8: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 9: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
10: U 5058340000002600001000000000000000000000000000000000000000000000 2fab057d
11: U 5058340000ac26000010000000ffffffffffffffffffffffffffffffffffffff 55393c7b
12: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
13: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
14: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
15: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6

nsh> otp lock 10
otp: Invalid arguments
otp: usage:
otp show - show all block contents and lock bitsotp write <blocknum> <32 hex bytes, LSB first, no spaces> <crc32 for bytes> - will print values after readback
otp read <blocknum> - will print 32 bytes readback from block (and the current CRC)
otp lock <blocknum> <blocknum> - will permanently lock the specified block number

nsh> otp lock 10 10
LOCKED

nsh> otp show
 0: L 5058340000ac26000010000000ffffffffffffffffffffffffffffffffffffff 55393c7b
 1: L 3296c91156c6a2cd9d472bd768e74ad9c731d43b9180a994f9b927517e41425a e50fcf15
 2: L 5207fe5842dd9bcd27f2077759ca977292334e8c366969f3797efaaa6940ad00 26df18c8
 3: L c0190f185410e5fd13dce5b37b8f8030ab84e1fa1c026088eb1ee4b224fb662b ae616df5
 4: L a800a8110a956c55fe43698fa584e9a1d7f8b10495e3460c1de681c0c7b89875 3245288a
 5: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 6: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 7: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 8: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
 9: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
10: L 5058340000002600001000000000000000000000000000000000000000000000 2fab057d
11: U 5058340000ac26000010000000ffffffffffffffffffffffffffffffffffffff 55393c7b
12: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
13: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
14: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
15: U ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff e666fea6
nsh>
</pre>
@bugobliterator
Copy link
Member Author

requires addition of otp as system commands in ardupilot build system to work

@bugobliterator
Copy link
Member Author

@tridge can you review this?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.