Skip to content

Commit

Permalink
Add timed read for smartcards + littles changes (#160)
Browse files Browse the repository at this point in the history
* Add pullup on card detection + change to exact baudrate @3.5Mhz clock (1/((1/3500000)*372))

* Change smartcard default speed to 9408 for 3.5Mhz clock
  • Loading branch information
0xDRRB authored Feb 18, 2024
1 parent dbf00c3 commit 8e44c7b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/drv/stm32cube/bsp_smartcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static void smartcard_gpio_hw_init(bsp_dev_smartcard_t dev_num)
/*SMARTCARD1 CD pin configuration*/
GPIO_InitStructure.Pin = BSP_SMARTCARD1_CD_PIN;
GPIO_InitStructure.Mode = GPIO_MODE_INPUT;
GPIO_InitStructure.Pull = GPIO_NOPULL;
GPIO_InitStructure.Pull = GPIO_PULLUP;
HAL_GPIO_Init(BSP_SMARTCARD1_CD_PORT, &GPIO_InitStructure);
}

Expand Down Expand Up @@ -142,7 +142,7 @@ bsp_status_t bsp_smartcard_init(bsp_dev_smartcard_t dev_num, mode_config_proto_t
hsmartcard->Instance = BSP_SMARTCARD1;

/* Defaults */
hsmartcard->Init.BaudRate = 9600; /* Starting baudrate = 3,5MHz / 372etu */
hsmartcard->Init.BaudRate = 9408; /* Starting baudrate = 3,5MHz / 372etu */
hsmartcard->Init.WordLength = SMARTCARD_WORDLENGTH_9B;
hsmartcard->Init.StopBits = SMARTCARD_STOPBITS_1_5;
hsmartcard->Init.Parity = SMARTCARD_PARITY_EVEN;
Expand Down
2 changes: 1 addition & 1 deletion src/hydrabus/hydrabus_bbio_smartcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "hydrabus_bbio_smartcard.h"
#include "bsp_smartcard.h"

#define SMARTCARD_DEFAULT_SPEED (9600)
#define SMARTCARD_DEFAULT_SPEED (9408)

void bbio_smartcard_init_proto_default(t_hydra_console *con)
{
Expand Down
2 changes: 1 addition & 1 deletion src/hydrabus/hydrabus_mode_smartcard.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "bsp_smartcard.h"
#include <string.h>

#define SMARTCARD_DEFAULT_SPEED (9600)
#define SMARTCARD_DEFAULT_SPEED (9408)

static int exec(t_hydra_console *con, t_tokenline_parsed *p, int token_pos);
static int show(t_hydra_console *con, t_tokenline_parsed *p);
Expand Down

0 comments on commit 8e44c7b

Please sign in to comment.