329 Commits

Author SHA1 Message Date
Iceman 1709c2ffd5 Merge pull request #37 from ceres-c/rrg-iso15693-codec-upd
Porting ISO15693 codec and applications updates
2020-09-13 00:50:25 +02:00
Federico Cerutti ebd6ab5842 Fixed timing issues with Read Multiple Blocks
ISO15693 CRC calculation is slow and it delayed too much transmission of long
frames. Some readers marked transmission as unsuccesfull and ignored data.
Moving CRC calculation inside the codec allows to start modulating the field
while the CRC is not yet ready but, by the time it has to be trasmitted,
calculation will be done.
This fixes https://github.com/emsec/ChameleonMini/issues/262

In EM4233, there still are issues with Read Multiple command when block
locking status is requested for more than 0x1F blocks

Implemented a check in ISO15693 codec to avoid out of bound CRC writes.
2020-09-10 16:05:35 +02:00
Federico Cerutti d43942469a Fixed hasty copy-paste 2020-09-09 20:13:59 +02:00
Federico Cerutti c6b936640f Improved ISO15693 applications performance
Removed the if-elseif in EM4233 to use a switch case which yields minor
speed improvements of ~1,5 microseconds
Avoid reading the UID every AppProcess tick in both EM4233 and TiTagIT
to save ~11 microseconds.
2020-09-04 01:48:39 +02:00
Federico Cerutti 4135ca135c ISO15693 Codec minor fixes
Unvarying interrupt configuration moved from StartISO15693Demod to CodecInit
Fixed an old issue (https://github.com/geo-rg/ChameleonMini/issues/4) properly
overwriting the PERBUF register when no data has to be sent
Loadmodulation ISR has a new GOTO label which is called when ISO t1 time is
elapsed, but data is not yet ready. This way it is possible to avoid checking
for state validity on every ISR hit
New inline function to clean up interrupts when field noise (garbage)
is incorrectly picked up
Bitrate configuration in ISO15693_EOC has been simplified

Cleaned up header file with useless defines. Moved defines to .c when there was
no need to share them with other source files

Annotated numer of clock cycles consumed by asm ISR sharing routine

As usual, this work was done with @MrModDom
2020-09-04 01:41:22 +02:00
Federico Cerutti 8494044b98 Merge fixes for GCC 10 2020-08-28 19:21:43 +02:00
Federico Cerutti c82572daf3 Updated code to build with GCC 10 - Updated ISR Sharing
Since GCC 10, the compiler defaults to -fno-common, thus variables with
multiple tentative definitions result in linker errors.
We've (me and @MrMoDDoM) extern-ed the shared variables to fix the issue.

Also, when I implemented ISR sharing, somehow I forgot about a function
which was shared as well, so I fixed that mistake and added a couple of
comments on how shared function calls work.
2020-08-26 20:19:33 +02:00
Federico Cerutti 86be22d2c7 Shared a function I forgot about, documented sharing practises 2020-08-26 17:19:05 +02:00
Fabian 22023b7356 add macro for shared isr call 2019-12-13 10:46:58 +01:00
Fabian d81c339d5f update LATEST 2019-12-11 15:13:47 +01:00
fptrs 868d8b6ad9 Merge pull request #243 from ceres-c/master
Faster ISR sharing in ASM
2019-12-11 15:00:31 +01:00
Federico Cerutti 247a0ffd55 Faster ISR sharing in ASM
While in the process of writing a new codec I stumbled upon the long
standing issue of ISR sharing in AVR MCUs.
Actually this is accomplished with an ISR written in C, which simply
calls another plain C function referenced via a function pointer
updated at runtime.
This approach is slow because GCC can't optimize the ISR, since it
does not know which registers will be used, so it defaults to push/pop
all of them.

My solution keeps the concept of pointers to functions, but greatly
improves speed by reducing the ISR itself to the bare minimum to call
another function, which will be compiled by GCC as a signal.
This means all interrupt optimizations will be put in place by GCC,
while ISRs can be still written in plain C code, but the overhead is
now much smaller. It has proven to reduce by 20 the number of
instructions for every ISR, mainly pushes/pops, which cuts the clock
cycle count down by 30 cycles (1 cycle for every push, 2 for pop).
In time units, this means 1.1 uSec are saved for every ISR invocation
and every shared ISR now takes only 13 clock cycles more than the
"bare" one.

A new ISR_SHARED function type has been defined in Common.h to hide
away from the programmer GCC attributes. All new shared interrupt
handling routines should be defined of this type to prevent
stack and registers corruption.

Minor changes were made to Codec.h to allow including it in .S files.
2019-12-08 14:11:05 +01:00
Fabian 1a41b8a321 fix merge issue 2019-12-06 16:47:18 +01:00
Fabian 1c8b05db25 Merge branch 'master' of https://github.com/emsec/ChameleonMini 2019-12-06 15:01:53 +01:00
Fabian a1ea90a356 Merge branch 'epozzobon-master' 2019-12-06 15:00:46 +01:00
Fabian 7d204284c2 Merge branch 'master' of git://github.com/epozzobon/ChameleonMini into epozzobon-master 2019-12-06 14:59:12 +01:00
fptrs 3bb7fc0eb1 Merge pull request #241 from hsanjuan/docs/clone_mfu
Docs: add documentation for CLONE_MFU button and command actions
2019-12-06 14:47:35 +01:00
Hector Sanjuan e83cdcd4af Docs: add documentation for CLONE_MFU button and command actions 2019-11-25 10:41:17 -06:00
Fabian dabef1b757 update LATEST 2019-11-25 13:31:45 +01:00
Fabian c857696bab make style 2019-11-25 13:29:14 +01:00
fptrs 0290bb77a7 Merge pull request #239 from hsanjuan/feat/mfu_clone
CLONE_MFU: command and button action
2019-11-25 13:27:26 +01:00
Hector Sanjuan 31b0b6391a CLONE_MFU: command and button action
This adds automatic cloning of Mifare Ultralight cards to the selected
setting.

Currently, only the DUMP_MFU command existed. In order to clone a Mifare
Ultralight card, the user had to convert the hex output of DUMP_MFU to binary
and upload the result to the card.

The CLONE_MFU command will attempt to read and store the Mifare Ultralight
contents directy to the slot which is then transitioned to emulation mode.

The CLONE_MFU button action does the same, so the board can be configured to
clone cards by simply selecting a slot with one button and cloning with the
other.
2019-11-20 07:04:55 -06:00
Fabian a35610f6a7 run make style #237 2019-11-15 10:21:40 +01:00
fptrs c0845811d1 Merge pull request #237 from doegox/make_style
make style proposition
2019-11-15 10:02:00 +01:00
Fabian 3a57fee52d updated LATEST 2019-11-11 20:20:44 +01:00