Commit graph

5352 commits

Author SHA1 Message Date
bunnie
2bb58bb63f fix #337 2023-03-24 22:53:19 +08:00
bunnie
d96361e1cf factory requests: longer oqc tune time, revert vcc_int threshold
changes to be applied for next production run
2023-03-24 20:07:54 +08:00
bunnie
aaaacabc35 bump release notes 2023-03-24 01:45:43 +08:00
bunnie
106cf5dfe6 fix RTC corruption issue on shutdown
Alright, this one was very tricky.

The problem here turns out that if the very last operation
on the RTC was a write before powering off, any spurious
clock/data noise is interpreted as a valid write to the RTC!

Thus, if the last thing you do to the RTC before a suspend is
a write of some sort, the RTC is going to be corrupted. During
shutdown, the RTC lines slam up and down a couple of times:

- they drop low as vcore discharges
- they then pop high once vcore is dead
- they then slowly drop low as vddio drops

in both of these cases, they drop with a very slow (>10ms)
fall time, which gives ample time for the RTC to get excited
and think maybe some data is being written to it! Also on boot,
there is a brief glitch of SDA/SCL at the same time, which looks
very much like a start condition.

Anyways, this patch does two things:

1. Performs a dummy read to a register that is "far from" any
critical data resisters. This puts the I2C state machine
of the RTC in "read" mode, so any future clock cycles just
keep wheeling through the RTC bank as a read, instead of clocking
in data as a write. There is a non-zero chance that the noise
"could" emulate a valid I2C transaction (it'd have to create
the bit pattern that addresses the RTC, with the right timing),
but in practice this hasn't been seen.

2. Disables the RTC block on suspend, prior to suspend. This
will prevent the RTC engine from issuing any new commands as
the core starts to shut down. It's conceivable that e.g. the
"start" bit could randomly flip high as the power goes down
and since the I2C engine is now in the always-on domain it'll
dutifully start clocking out bits as the power goes away.

This patch seems to have stabilized the RTC corruption problem
that was previously witnessed.
2023-03-24 01:31:25 +08:00
bunnie
19b3014f4b have the RTC recover more gracefully from a "line noise" shutdown
simply throwing errors over and over again in a loop doesn't help anyone.
2023-03-24 01:30:41 +08:00
bunnie
4800cca65e add helper function to extract bcd time values 2023-03-24 01:30:15 +08:00
bunnie
e479de4e02 make time errors print the full RTC value set
this is necessary to debug more I2C weirdnesses.
2023-03-24 01:29:24 +08:00
bunnie
6a1d8f66f8 give a little more margin in sleep stress test to recover/setup/shudown 2023-03-24 01:28:56 +08:00
bunnie
e1881fa4a2 fix a missing feature flag 2023-03-24 01:28:39 +08:00
bunnie
6f80923609 fix hosted mode...again... 2023-03-23 21:38:17 +08:00
bunnie
80bbdd10a5 fix double-free error (take 2) 2023-03-23 21:34:29 +08:00
bunnie
cb5bd20739 match latest soc_csr candidate 2023-03-23 21:23:05 +08:00
bunnie
e26df60599 disable WFI during I2C transactions
CPU is sleeping during I2C transactions, leaving the bus in a state
where the I2C transaction is continuously being fired over and over
again because the way LiteX creates CSRStorage, it gives the
CPU precedence over the block's update.

Basically what happens is that the CPU writes something to the
I2C, goes to sleep, and leaves the I2C block selected. This causes
the I2C block unable to clear its own I2C transaction initiation
register, subsequently leading to the I2C transaction being repeated
over and over again until the CPU wakes up and stops jamming the
bus in that state.

By forcing WFI on during I2C transactions, the CPU is more responsive
during I2C and also we prevent the I2C transactions from being restarted.

This was verified using an oscilloscope.
2023-03-23 21:20:33 +08:00
bunnie
16c48b4f5b minor tweak on debug levels 2023-03-23 21:20:17 +08:00
bunnie
33960277c1 fix hosted mode 2023-03-23 17:52:59 +08:00
bunnie
78e9824950 log if an unexpected interrupt happens on I2C 2023-03-23 16:01:13 +08:00
bunnie
673a3f1364 Merge branch 'main' of github.com:betrusted-io/xous-core into main 2023-03-23 15:31:10 +08:00
bunnie
4af7699f0d remove double-free path in I2C driver 2023-03-23 15:30:55 +08:00
bunnie
3e0b2e173d
Merge pull request #332 from markhuge/docs-hosted-dpad
Document dpad keymapping in hosted mode
2023-03-23 14:23:12 +08:00
Mark Wilkerson
2e56716a7a add dpad hosted mode mapping 2023-03-22 19:28:44 -07:00
bunnie
e32a22655b add a sanity check on the reported EC version 2023-03-23 03:17:05 +08:00
bunnie
0af6daa7b9 bump release notes 2023-03-22 03:10:35 +08:00
bunnie
c0ed701c08 remove implementations from the crates.io set
Restrict crates.io published set to just APIs, not implementation
files. Nobody is using the implementations anyways -- it was requested
but I've never seen the package pulled except for CI.
2023-03-22 03:09:03 +08:00
bunnie
704aaf98af bump versions for kernel interface changes 2023-03-22 02:48:55 +08:00
bunnie
57cea9b3ca cleanup a warning when debug is not turned on 2023-03-22 02:47:41 +08:00
bunnie
63c7600eb5
Merge pull request #331 from Foundation-Devices/kernel-arm
Add ARM support to kernel and xous-rs
2023-03-22 02:42:21 +08:00
bunnie
488a220d43
fix URL to public URL
didn't know i could just edit this directly in GH!
2023-03-22 01:05:10 +08:00
bunnie
773bbc695a
Merge pull request #330 from Foundation-Devices/loader-arm
loader: add ARMv7-A support via sama5d27 chip
2023-03-22 00:34:00 +08:00
eupn
1f2b45e60f
loader: replace ssh git dependency with https 2023-03-20 23:54:56 +04:00
bunnie
8a2e369791 bump release notes 2023-03-19 01:00:45 +08:00
bunnie
0c752edba4 update SoC to latest candidate 2023-03-19 00:58:41 +08:00
bunnie
ce9d5522c9 recover gracefully from I2C errors on resume
fix an issue where I2C, if not working well on resume, is not
recovered correctly. This patch improves that and hardens
the RTC code so that it handles a case that normally panics
with a try-harder loop.
2023-03-19 00:55:07 +08:00
bunnie
2b40e3e262 fix hosted mode 2023-03-18 00:12:56 +08:00
bunnie
ee6561f5d9 fix bugs in i2c timeout handler
seems to work now, recovers from timeout conditions more gracefully.
2023-03-18 00:06:35 +08:00
bunnie
a59de6d655 cleanup hosted mode warning (new with rust 1.68) 2023-03-17 22:19:04 +08:00
bunnie
900dbc3c51 fix hosted mode 2023-03-17 22:15:46 +08:00
bunnie
76a7d05156 add timeout logic to I2C driver 2023-03-17 22:12:02 +08:00
bunnie
5efbff0098 add note about GPIO usage vs WFI mode 2023-03-17 02:24:57 +08:00
bunnie
d413100102 handle edge case of a "perfect fit" loader section
When a block of data perfectly fits we fail to allocate the
next page, violating the loop invariant that there's data available
to write.

However, we can't always allocate a new page when we run out
because if we're at the end of the process we shouldn't allocate
a new page (I think). Thus we track if the last section was
a perfect fit, and if it was, we force a new page allocation
before copying more data.

This is an edit in phase 1 of the loader.
2023-03-16 01:05:07 +08:00
bunnie
137f23039b fix formatting on check print 2023-03-16 01:04:45 +08:00
bunnie
2cda7fc418 give the EC some time to boot before querying its version 2023-03-15 02:26:56 +08:00
eupn
723a730231
kernel: fix warnings 2023-03-14 19:01:11 +04:00
eupn
a027fc6a2c
xous-rs: checkout ARM assembly binary 2023-03-14 19:00:49 +04:00
eupn
b720426855
xous-rs: extend assemble script with arm arch 2023-03-14 19:00:17 +04:00
eupn
92969c8d42
xous-rs: extend build script to pick arm assembly binary too 2023-03-14 18:59:49 +04:00
eupn
294d75da4e
xous-rs: add ARM arch modules 2023-03-14 18:59:13 +04:00
eupn
76114c060a
xous-rs: add increase_heap syscall
This is used in ARM version of dlmalloc-rs for Xous stdlib
2023-03-14 18:51:07 +04:00
eupn
0f420b7b63
xous-rs: add "device" memory flag 2023-03-14 18:49:22 +04:00
eupn
e2d34d364c
kernel: always print when process is terminated 2023-03-14 18:48:45 +04:00
eupn
1634243f63
kernel: fix compile errors 2023-03-14 18:48:15 +04:00