mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
FPC experiments: got so far TX_only, usart=115200 + usb=460800, see full commit msg
* Add \r\n to sent strings * remove usart_init() from UsbPacketReceive cmd, it's already init in main. * Add PLATFORM PM3RDV4FPC to ease dev * TX: US_TCR is len of data to send, not len of buffer * Use only one PDC bank as we're using it in sync * Busy loop to wait for end of TX as we'using it in sync * Change usart speed to 115200 * Don't downgrade USB speed, keep 460800 * Attempt to detect received data, fail so far
This commit is contained in:
parent
d448549524
commit
7bd95dd5c3
5 changed files with 29 additions and 37 deletions
|
@ -5,6 +5,8 @@ define KNOWN_PLATFORMS
|
|||
+--------------------------------------------------------+
|
||||
| PM3RDV4 (def) | Proxmark3 rdv4 with AT91SAM7S512 |
|
||||
+--------------------------------------------------------+
|
||||
| PM3RDV4FPC | Proxmark3 rdv4+FPC (experimental) |
|
||||
+--------------------------------------------------------+
|
||||
| PM3EVO | Proxmark3 EVO with AT91SAM7S512 |
|
||||
+--------------------------------------------------------+
|
||||
| PM3EASY | Proxmark3 rdv3 Easy with AT91SAM7S256 |
|
||||
|
@ -31,6 +33,10 @@ ifeq ($(PLATFORM),PM3RDV4)
|
|||
MCU = AT91SAM7S512
|
||||
PLATFORM_DEFS = -DWITH_SMARTCARD -DWITH_FLASH
|
||||
PLTNAME = Proxmark3 rdv4
|
||||
else ifeq ($(PLATFORM),PM3RDV4FPC)
|
||||
MCU = AT91SAM7S512
|
||||
PLATFORM_DEFS = -DWITH_SMARTCARD -DWITH_FLASH -DWITH_FPC
|
||||
PLTNAME = Proxmark3 rdv4
|
||||
else ifeq ($(PLATFORM),PM3EVO)
|
||||
MCU = AT91SAM7S512
|
||||
PLTNAME = Proxmark3 EVO
|
||||
|
|
|
@ -66,27 +66,20 @@ inline int16_t usart_readbuffer(uint8_t *data, size_t len) {
|
|||
}
|
||||
}
|
||||
|
||||
inline bool usart_dataavailable(void) {
|
||||
return (pUS1->US_CSR & AT91C_US_RXRDY) != 0;
|
||||
}
|
||||
|
||||
// transfer from device to client
|
||||
inline int16_t usart_writebuffer(uint8_t *data, size_t len) {
|
||||
|
||||
// Check if the first PDC bank is free
|
||||
if (!(pUS1->US_TCR)) {
|
||||
if (pUS1->US_TCR == 0) {
|
||||
memcpy(us_outbuf, data, len);
|
||||
pUS1->US_TPR = (uint32_t)us_outbuf;
|
||||
pUS1->US_TCR = sizeof(us_outbuf);
|
||||
pUS1->US_TCR = len;
|
||||
|
||||
pUS1->US_PTCR = AT91C_PDC_TXTEN | AT91C_PDC_RXTDIS;
|
||||
while((pUS1->US_CSR & AT91C_US_TXEMPTY) ==0) {};
|
||||
return 2;
|
||||
}
|
||||
// Check if the second PDC bank is free
|
||||
else if (!(pUS1->US_TNCR)) {
|
||||
memcpy(us_outbuf, data, len);
|
||||
pUS1->US_TNPR = (uint32_t)us_outbuf;
|
||||
pUS1->US_TNCR = sizeof(us_outbuf);
|
||||
|
||||
pUS1->US_PTCR = AT91C_PDC_TXTEN | AT91C_PDC_RXTDIS;
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
|
@ -130,7 +123,7 @@ void usart_init(void) {
|
|||
// 115200 * 16 == 1843200
|
||||
//
|
||||
//pUS1->US_BRGR = (48UL*1000*1000) / (9600*16);
|
||||
pUS1->US_BRGR = 48054841 / (9600 << 4);
|
||||
pUS1->US_BRGR = 48054841 / (115200 << 4);
|
||||
|
||||
// Write the Timeguard Register
|
||||
pUS1->US_TTGR = 0;
|
||||
|
|
|
@ -9,4 +9,5 @@ void usart_close(void);
|
|||
|
||||
int16_t usart_readbuffer(uint8_t *data, size_t len);
|
||||
int16_t usart_writebuffer(uint8_t *data, size_t len);
|
||||
bool usart_dataavailable(void);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue