the USB trace now respects the global setting.
the verbosity is also decreased, not showing USB activity unless
debugging.
this also saves some space.
the reset cause is now printed.
the strings increase the bootloader size, but it already exceeded
the 16 kB limit when trace level is set to info.
Change-Id: I9ba08d4bb4f188f6e7a202ea86acb7a42a2054f3
now both partitions (bootloader and application) use a commonly
defined memory location to shared the DFU state (which includes
the magic value to know which part to start), instead of using
a hard coded value.
the bootloader size has now also been restricted to 16 kB.
this limitation is enforced so to not be able to create larger
images, which could be corrupted when flashing the application.
bootloader and application flashing have been successfully tested
on qmod st12 and st34.
Change-Id: I204bed7e9391602672ed894decec1fc12e879275
this will help seeing how much free space is available for the
bootloader (which is restricted to 16 kB)
Change-Id: Ie74a1480c2f340765046be9bdfc3a8c4ba851e9b
There's no point in building a DFU loeader that is to be flashed
via DFU - nor is there really any need for regular cardem/trace
that can be flahsed directly without DFU. If anyone needs those,
they can still build them - but let's not confuse the average other
user.
Change-Id: I0abe86c6a942a59e5b2417d0532dffae654d7a18
Closes: OS#4087
"SIMtrace 2 compatible device" is pretty generic. Let's have the
actual board name inside the string descriptors, giving a more
user friendly experience in case users are issuing 'lsusb' and the
like.
Change-Id: Ibcc338b504bd2a1605e31d7f5eadb7161f547c6a
This string dates back to some very early naming; let's reflect how
we have been calling this in reality for quite some time now.
Change-Id: I5a7497188385706a1e924784073c619fa9bfdd60
The code in board_main_top() for QMOD blindly re-assigned some
members of the usb_strings[] array, writing to index 7 and 8.
However, that array only has those entries in the main firmware,
while in DFU that array has only 6 entries. Depending on whatever
the linker has decided to put in the next memory location after
that array, we would overwrite that very early during boot-up.
Change-Id: I59e4e1a54e819808d5a8259a6d14f4b970a90020
Related: OS#4302
when starting the DFU bootloader, but USB configuration (e.g.
enumeration) failed, the MCU restarted in the main application.
this occured after a DFU detach and were the USB host missed the
USB reset.
now after MCU reset, the bootloader is started again, since this
is what was requested to begin with.
the bootloader will always restart in the bootloader until USB
enumeration succeeded.
this boot loop can be stopped by unplugging/removing power from
the device.
Change-Id: I4062a7d8a7934af2119c169759b614dc45990651
the specification requires a reset duration of at least 10 ms.
reset is indicated by the device to the host by removing the
pull-up on D+ (host to device reset is a USB packet).
we used 20 ms, but on some setups (USB host, stack, hub, and load
dependent), this does not seem to be enough (no USB enumeration
was performed afterward, at least for the DFU bootloader).
increasing to 50 ms solved the issue on the affected setups.
instead of USB suspend, the more proper USB disconnect is used.
this mainly disables the pull-up provided by the USB peripheral.
USB activate is not required since the follow up initialisation
takes care of it.
Change-Id: If5ceb3b8f7a8f134d4439fdd138dd12b46589f97
This is the shortest and simplest ATR possible according to the
ISO 7816-3 spec.
It does not offer any non-default parameters (F, D, WI, ...)
Change-Id: I4ff41b5120bcadca652296f9d3691f7606be2bd2
this ATR does not encode any data and uses all defaults.
the lower default speed is also better handled by the hardware.
handling faster speeds is upcoming.
Change-Id: I5a4f2f94bea1a15aedbef5a6f2f49344387dc11d
monitoring the state changes of the VCC and nRST lines is required
to correctly detect warm and cold reset
Change-Id: I72099956332724f84226e1495fdc5a5b1a034695
else it's too nosy while debugging other components, not often
used, and break the flow since it does not and a line.
Change-Id: I8920ff7c33b4c9fb174bb31a29334a63fcbede43
the longer output is to fast and often incomplete.
the shorter version is enough to view the progress when not
debugging.
Change-Id: I97bb84da68d1f3bc14fb7c05400edf1748f55460
Make building the debian packages work again. I've verified that it
works in my own OBS namespace.
This patch also adds missing pkgconf variables in host/Makefile.am, so
libosmo-simtrace2.pc installs properly.
Related: OS#4283
Fixes: 964cda309d ("host: use autotools and split shared code to libosmo-simtrace2")
Change-Id: I2377de1e8b149520922217a1ab16f6e22fe6462a
Fixes:
simtrace2-sniff.c:113:4: error: format not a string literal and no format arguments [-Werror=format-security]
printf(flag_meanings[i].str);
Change-Id: I9793c680f070e724ce89272e9e489963c7516d52
on the QMOD board the VCC signal from the modem is measured using
an ADC (SIMtrace board just use card detect).
the threshold to consider VCC as activated was set to 2.8V, which
gives a bit of margin for the expected 3.0V.
still, we had one board where the voltage was 2.8V.
to be resilient against lower than expected voltages from
modems (or boards), we lowered the threshold to 2.5V.
this is still save for the SAM3S to correctly identify high/low
levels.
Change-Id: Iac2778903690045e4e63fef29f812205d00c28ed
when the reader sends APDU headers (e.g. after multiple reset),
messages are queued for USB transmission.
but if no host software is connected to SIMtrace in card emulation
mode, the USB message queue is not emptied, leading to the memory
getting full and preventing allocation for newer messages (e.g.
more recent APDU).
in this case the oldest queued message is now dropped to free some
memory.
Change-Id: Ie9ebdd2ff966f67c9afd1ed760f106558f0091ad
in case flashing the main application firmware using DFU failed,
the main application might be broken and not allow to switch again
to DFU mode to re-flash it correctly.
the other board have a way to force entering (e.g. staying in) the
bootloader using an external signal (e.g. a switch on the SIMtrace
board).
the OWHW DFU firmware did not have this functionality implemented.
the design (e.g. schematic) already has the SIMTRACE_BOOTLOADER
signal (on PA31) for this purpose.
now the DFU bootloader will start the DFU mode when the
SIMTRACE_BOOTLOADER is high.
this change has been tested on OWHWv2.
Change-Id: Iefff51a811ad0f3bf3a46b8e256b905d11344bea
as for the main application firmware, the DFU bootloader firmware
now also has the unique chip ID as iSerial in the USB description,
and an additional empty USB configuration indicates the firmware
version (e.g. DFU bootloader version).
these are only visible when the device is in DFU mode.
Change-Id: I11a2cd8079fda374d816da180f39f1c33d10af60
ISO-7816 specifies a card activation sequence: VCC on, CLK active, then RST
release.
we now check for the end state at every state of the activation in case the
reader does not strictly follows the sequence.
change has been tested on OWHW slot 1.
Change-Id: Ie55505ab3a70cbd64281af40af53d5e120313228
previously the card RST, VCC, and CLK signal states have been initialized with
default values corresponding to an inactive reader.
this worked fine for actual inactive readers since the default values match
and would be updated when the signal changes (edge detection).
but if the reader is in another state, card activation detection could fail.
this is fixed since the actual signal values are now used during initialisation.
at the same time I changed the variable type from uint8_t to boolean since they
have only two possible states, and understanding the actual state when coding
is simpler (no need to check which integer corresponds to which state).
this change has been successfully tested on the 2 slots of OWHW board.
Change-Id: Ie9245d75d48ae93d16f97897d4fa5ad6cd402e73
the OctSIM tester has only one amber LED.
this is now mapped to the normally green LED, used for activity.
because the LED is driven by an NPN transistor (as open collector)
instead of being directly connected to the pin (as open collector)
like on the other boards, the logic is inverted.
since normally the LED is on on idle and blinks during activity,
it will now be off on idle an only blink on activity (unless the
code is extended to cope with the possible inverted logic).
because there is no second LED but the current code requires one,
I mapped is to an unused pin.
the octosimtest target still does not compile completely, but at
least the LED issue is fixed.
Change-Id: I1296833bef2804c611640fcf4756e47905660e7b
the LEDs (2 of them) were connected to the same pins on all
boards, up to the octsim-tester.
to be able to have board specific LEDs the definitions have moved
from common to the each board.
at the same time I added a bit of documentation what the LEDs are
used for.
Change-Id: I3226a9187a8d0b657ccf5dcd8f3586b2578f96d2
SIM_PWEN and VCC_FWD are signals specific to the simtrace boards.
the corresponding pins PA5 and PA26 are used for other signal
on the octsim-tester.
Change-Id: I51f37dd112cf681f4b1dbb3d2320ff9a697eaa08
previously the version string was in the iConfiguration field of a
dedicated USB configuration.
this configuration had no interface, but the USB specification
requires at least one interface.
an interface has been added to this configuration.
the version string is now in the iInterface field, and the
iConfiguration field contains "firmware version".
the USB specification does not require an end-point, and none are
present.
Change-Id: I99361e313979711f4f45ad424a52faa3ddd7c558
disabling the ERASE pin prevents accidental erase for the flash
memory while the board is powered on (e.g. in case the user
overcomes the weak 100 kOhm pull-down for more than 220 ms by
touching or shorting the pin).
the flash is still erasable using the ERASE pin during power up.
it is only disabled after boot completed.
Change-Id: Ic3332eb1d4247a07988b2fd841f40e79862d06a7
The most recent commits introduced 'C99' syntax by declaring variables
inside the 'for' statement itself, rather than before.
This resulted in compile failures in the Ubuntu 16.04 builds on
build.opensuse.org:
[ 105s] libcommon/source/usb.c: In function 'SIMtrace_USB_Initialize':
[ 105s] libcommon/source/usb.c:679:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
[ 105s] for (uint8_t i = 0; i < ARRAY_SIZE(device_id_string) - 1; i++) {
[ 105s] ^
[ 105s] libcommon/source/usb.c:679:2: note: use option -std=c99, -std=gnu99, -std=c11 or -std=gnu11 to compile your code
[ 105s] libcommon/source/usb.c:686:15: error: redefinition of 'i'
[ 105s] for (uint8_t i = 0; i < ARRAY_SIZE(git_version) - 1; i++) {
[ 105s] ^
[ 105s] libcommon/source/usb.c:679:15: note: previous definition of 'i' was here
[ 105s] for (uint8_t i = 0; i < ARRAY_SIZE(device_id_string) - 1; i++) {
[ 105s] ^
[ 105s] libcommon/source/usb.c:686:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
[ 105s] for (uint8_t i = 0; i < ARRAY_SIZE(git_version) - 1; i++) {
[ 105s] ^
[ 105s] libcommon/source/usb.c:692:15: error: redefinition of 'i'
[ 105s] for (uint8_t i = 0; i < ARRAY_SIZE(usb_strings) && i < ARRAY_SIZE(usb_strings_extended); i++) {
[ 105s] ^
[ 105s] libcommon/source/usb.c:686:15: note: previous definition of 'i' was here
[ 105s] for (uint8_t i = 0; i < ARRAY_SIZE(git_version) - 1; i++) {
[ 105s] ^
[ 105s] libcommon/source/usb.c:692:2: error: 'for' loop initial declarations are only allowed in C99 or C11 mode
[ 105s] for (uint8_t i = 0; i < ARRAY_SIZE(usb_strings) && i < ARRAY_SIZE(usb_strings_extended); i++) {
[ 105s] ^
[ 105s] Makefile:227: recipe for target 'obj/simtrace/flash_usb.o' faile
Change-Id: Ibdb837ac105664484b10873c2c0d9561051b1c2a