There’s an interesting issue in SOSSE that prevents it from running right on some Atmega163-based smartcards if you just make the obvious changes to port it. The usual symptom is that the card ATRs correctly, but won’t listen to any commands.
Most of these cards connect the smartcard’s IO pin to both the normal pin PB6 and to an additional pin which SOSSE doesn’t use. SOSSE configures all the pins it doesn’t use as outputs and sets them HIGH during the startup code. This results in an additional and unwanted strong pull-up to Vcc on the IO pin, which prevents most smartcard readers from being able to pull it low and actually talk to the card.
The easy solution: open hal.c, find the lines that read:
outb(0xFF,DDRA);
…
outb(0xFF,DDRD);
and change the 0xFFs to 0x00s in these lines. Will upload a patch and link it from this post when I get around to it.
Uploaded the patch here. It also fixes some compilation issues on newer avr-libc versions
Thanks