using the synchronous HAL library causes RX overflow after 5 bytes
on bulk incoming data (e.g. pasted).
this mainly due to printing synchronously the character, but to
further prevent congestion we switch to asynchronous (e.g.
interrupt driven) communication.
The RX part works great now (no overflow), but the TX part is
malfunctioning because the HAL Async library does not buffer the
data to be transmitted and expects it to be in memory until
the transmission is complete (which printf does not do).
This change will not be reflected in Atmel START since it does not
allow to set the underlying STDIO redirect peripheral to async.
Change-Id: If18883e96f336aa9f6b11607859260da5e1503c7
using the SWO signal on TX has the advantage of being able to
have printf debug while still using SERCOM7 in ISO7816 mode for
the SIM card, but it has two drawbacks:
- SWO outputs data only if a debug session is ongoing (e.g. a SWD
debugger is connected). this saves output processing when no SWD
is connected, but it is not possible to force output without
having an SWD debugger connect (confirmed by Microchip help),
which is not convenient for simple UART debugging.
- no input is possible (SWO can only output).
Thus instead we will still use SERCOM7 for UART debug, allowing
commands to be input.
SERCOM7 should only be used for UART debug when no card in present
in SIM7.
This check in not yet implemented.
Change-Id: I199d6e356129526e65d5d1075a264eb35904d099
we use the SERCOM peripheral for USART (in 7816 mode SIM card
communication) in synchronous mode (TX and RX clock are the same).
in this mode only the 8 least significant bits of the BAUD register
are used (see TRM 33.6.2.3 Clock Generation – Baud-Rate Generator).
When the SERCOM is clocked at 100 MHz the minimum resulting baud
rate would be 100E6 / (2 * 255 + 1) = 195694 bps.
clocking SERCOM at 3.33 MHz also to have a baud rate of 6720 bps
(~ 3.33E6 / (2 * 247 + 1)), used after reset to read the ATR.
Change-Id: Id60322e092a6652a89821fc737d5336d79a1420c
the ISO7816 I/O baud rate is f / (Fd / Dd), with Fd 372, Dd = 1.
f_max is 4 MHz, but we will use the minimum 20 / 8 = 2.5 MHz,
thus the baud rate after reset will be 6720 bps.
Change-Id: I9165575404f070c7429daaa3593838d08a5c5e10
as the code will use alternative libraries, the examples will not
be able to compile anymore.
plus they are not required for the firmware and the example code
can be downloaded from Atmel start.
Change-Id: If53df47089de9eb8498734c19d6a0420c1e79031
This is form Atmel Start and provides functionality for hardware-based
DMA copies from memory to memory.
Change-Id: Ib07755b2c5974af70817f5460fb0f358c631452a
In hardware, the Card RST pin is low-active. There's a level
translator in the NCN8025, but there's no logic inversion, so RSTIN
is also low-active. In software, we have the policy of all signals
being "true-active", i.e. true represents the active state, and false
the inactive state.
Hence, we must invert the logic of how we handle rstin.
Change-Id: Ia45246b7517b2e6ecb01d22b3af52aee7a51de64
The ncn8025 has no impact on the UART, so no matter if we use
SERCOM7 as debug uart or as SIM UART, we can always initialize
the NCN8025 and thereby allow control of (e.g.) the LED.
Change-Id: I70ae1e050d5540627bc77626dbf1b6040e95dae4
this allows commands like
sim-status 0 # read the status
sim-voltage 0 5 # set voltage to 5V
sim-clkdiv 0 2 # set clock-divider to 2 (10 MHz)
sim-reset 0 0 # disable reset
sim-power 0 1 # enable power
Change-Id: Id6131be60d37cba769c79952fa44f3ec6c976a38
This is a very simplistic command line interface parser which
various parts of the code can use to register textual commands
on the debug UART.
Change-Id: I2d289228fb97ecde5602e9756f3d7c51fa65a3b7
this ASFv4 USB library change fixes USB transfer.
two transfer-size issues existed:
- on multi-packet transfer if the last packet was less than the
USB transfer packet size, the packet would be received but not
acknowledged
- during normal transfer the packet size of a previous packet set
the size of the current packet, ignoring the actual transfer size
Change-Id: I4209072ee808f0e246bcd5e86917dcf1d213c26b
It has been observed that the 20 MHz clock signal doesn't even remotely
resemble a square shape unless DRVSTR=1 is set using this patch.
Change-Id: I1366e13442eda829756aa4121be81eb15135c73e
This adds an I2C bit-banging layer, defines the four busses on the
sysmoOCTSIM and adds some high-level functions to control the NCN8025
for each SIM slot.
Change-Id: Ic5287cf80d2be2070c504e9d40f7c6fc0d37d8b9
without this relocation the DFU bootloader can jump to the
application but following executed code would not be the one from
the application.
Change-Id: Ieeefcf80918fd10e48debab6ff08505f6588811c
configure SERCOM 0 to 6 peripherals to communicate using the
ISO7816 T=0 protocol.
SERCOM7 should be for the 8th SIM card, but for now it is used as
UART debug output.
Auto-detection between SERCOM for the 8th SIM and debug UART will
be done later.
Change-Id: I3f1411ec5bc2ed7dfa714550d041f52be665132a
use GCLK5 to output 20 MHz clock on PA11/GCLK_IO[5] for SIM cards
clock.
this can be further divided by the NCN8025 before reaching the SIM.
Change-Id: I2c0d6a31ec63a87e04ef4e3afbedce3a221324cc
the SAM E54 Xplained Pro development board uses a SAM E54P20N
micro-controller.
the sysmocom sysmoOCTSIM prototype uses a SAM E54N19A
micro-controller.
the system LED and UART debug GPIO are different, else the code
is the same.
the Atmel START definitions have been updated accordingly.
Change-Id: Ifd15f6759c51b42a8d11b09f9f495d7e7a5b6afc
let main run the main loop instead of the CDC ACM example.
also rename the CDC ACM example functions.
Change-Id: I44b15079672b4058de1fa08365541317d54958dc
also remove unused armcc.
only the GCC cross-compiler is used.
the ARMCC Makefile would not be maintained.
Change-Id: Ib6ec525885943afba9b24df88a5bee8009df95b5
currently only the SERCOM peripheral driver is added an configured,
but it is not being used.
UART debug will be done through the EDBG COM port, on PB24/PB25 of
SAM E54 Xplained Pro board
Change-Id: Id7af37ce1dd2d0a356e019c96bf6438ce459411b
DPLL1 can take directly XOSC1 as input and divide it to 2 MHz.
thus the intermediate GCLK11 is not needed.
we now also completely de-configure GCLK11
this configuration is not supported by Atmel START since it does
not know about the division and thinks the input frequency
exceeds the maximum
GCLK2 is also disabled for now because it is not used
Change-Id: Icee7f5a13019c47cebc23376cabb18cb31178ece
use GCLK11 to bring external crystal oscillator XOSC1 from 12 MHz
to 2MHz
use DPLL1 to multiply 2 MHz to 100 MHz.
the division is first needed because the DPLL0 maximum input
frequency is 3.2 MHz
100 MHz is the maximum input frequency for the SERCOM peripherals
Change-Id: I0482c39cc0db999904c585d21738dbce57ca3b55
DPLL0 can take directly XOSC1 as input and divide it to 2 MHz.
thus the intermediate GCLK11 is not needed.
this configuration is not supported by Atmel START since it does
not know about the division and thinks the input frequency
exceeds the maximum
Change-Id: I121ad850cf118b641fe522b513ffd7e00b30b710