In the standard atmel lib only one configuration was possible.
On a GETDESCRIPTOR request the board would always return the full buffer
with both configurations.
The USB driver requests each configuration one after another, using the
configuration index number.
The atmel lib did not support more than one USB configuration.
But only when you program the chip. At some point it stops printing
the received bytes because the interrupt is not triggered anymore.
I do not know yet how and why this happens.
Even after restarting the board this state is maintained.
CLK_SIM, I/O_SIM, CLK_PHONE, I/O_PHONE: Each of these lines connect
two pins of the microcontroller. Therefore they should NEVER be
configured as output line simultaneously. Otherwise the uC might get
destroyed.
Serial smartcard reader sends data which should be processed.
In the USART1 IRQ a status variable is set to show that data has
arrived, which should be checked for in the main function.
The second argument for PIO_Configure is the list size,
which can be determined using the macro PIO_LISTSIZE.
You should pass the list (which is an array of pins) to it.
Refrain from passing the ADDRESS of the list to it, otherwise
the pin configuration is never applied and you find yourself
debugging for 3 days.
In other words:
It's working, don't touch it or it will break again!
For now the inttypes.h of the development computer is used.
Which is a bad state. The reason is
It should be fixed by creating a stdint.h in the Baselib, which
defines types like uint32_t, etc., or by entirely replacing the Baselibs
with the newlib.
This was an example of a compiler warning when the switch -Waddress was passed:
atmel_softpack_libraries/usb/device/core/USBD.c: In function 'USBD_RequestHandler':
atmel_softpack_libraries/usb/device/core/USBD.c:149:14: warning: the address of
'USBDCallbacks_RequestReceived' will always evaluate as 'true' [-Waddress]
else if (USBDCallbacks_RequestReceived) {
The test for existense of USBDCallbacks_RequestReceived is removed since there
is always a default implementation of these function.
This was an example of a compiler warning when the switch -Waddress was passed:
atmel_softpack_libraries/usb/device/core/USBD.c: In function 'USBD_RequestHandler':
atmel_softpack_libraries/usb/device/core/USBD.c:149:14: warning: the address of
'USBDCallbacks_RequestReceived' will always evaluate as 'true' [-Waddress]
else if (USBDCallbacks_RequestReceived) {
The test for existense of USBDCallbacks_RequestReceived is removed since there
is always a default implementation of these function.
When the SIM card adapter, which is usually plugged into a phone,
is plugged into a CCID reader instead, the CCID reader triggers
the reset line of the RST line and therefore a PIO interrupt.
The reader then waits for an ATR from the smartcard,
which should be send next.
The return value of ISO7816_GetChar is 0 in case of a timeout
when trying to retrieve values, and status of US_CSR otherwise.
Proper handling of this return value is not yet implemented though.
With the naive approach of just not sending the ATR if it could not
be read the simtrace firmware did not work together with pcsc_scan
AT ALL.