geekhack

geekhack Community => Other Geeky Stuff => Topic started by: vuckale on Sat, 06 February 2021, 12:40:45

Title: Can I replace this old board with teensy++2.0?
Post by: vuckale on Sat, 06 February 2021, 12:40:45
I attached a side by side pinout for the board I have in an old Compaq sdm4540ul keyboard and a Teensy++ 2.0. The keyboard has an SAMSUNG KS86C6404 board and here is the datasheet pdf: https://www.alldatasheet.net/datasheet-pdf/pdf/37385/SAMSUNG/KS86C6404.html. Can you help me figure out how to replace the old board with Teensy and better quest can it be done at all?
Title: Re: Can I replace this old board with teensy++2.0?
Post by: suicidal_orange on Sat, 06 February 2021, 12:47:55
Assuming the switch matrix (and LEDs?) attach to that chip you could certainly connect a Teensy to wires soldered to the socket/holes it fits in.  You will have to map the matrix, a nice picture with traces visible will show whether this will be easy or not but it's always doable if you're willing to put in the time :)
Title: Re: Can I replace this old board with teensy++2.0?
Post by: Tactile on Sat, 06 February 2021, 14:01:46
The info about the chip doesn't help you. Your keyboard switches are connected together in columns & rows. You need to use a multimeter to map out these columns & rows. This is what Orange was referring to when he said, "You will have to map the matrix". When you finish you'll have identified one wire for each row (probably 5 or 6) and one wire for each column (might be 16, might be 25, or anywhere in between). That info, and finding power & ground somewhere on the PCB, is what you'd need to know in order to hook up to a teensy. Then just program the teensy with TMK or QMK software and you're in business.

Mapping out the matrix isn't as hard as it sounds, and there are plenty of folks here willing to help.
Title: Re: Can I replace this old board with teensy++2.0?
Post by: vuckale on Sun, 07 February 2021, 19:48:01
Assuming the switch matrix (and LEDs?) attach to that chip you could certainly connect a Teensy to wires soldered to the socket/holes it fits in.  You will have to map the matrix, a nice picture with traces visible will show whether this will be easy or not but it's always doable if you're willing to put in the time :)

Thanks for the reply! I do know what a keyboard matrix is but have never tried to map it on any keyboard. Just one question; if I was to trace it to the pins, how do I know then which pin to connect where? Is there a correlation between for instance INT0 / P2.0 on KS86 and P(B, D, E, C, F)X on Teensy?
Title: Re: Can I replace this old board with teensy++2.0?
Post by: vuckale on Sun, 07 February 2021, 19:51:25
The info about the chip doesn't help you. Your keyboard switches are connected together in columns & rows. You need to use a multimeter to map out these columns & rows. This is what Orange was referring to when he said, "You will have to map the matrix". When you finish you'll have identified one wire for each row (probably 5 or 6) and one wire for each column (might be 16, might be 25, or anywhere in between). That info, and finding power & ground somewhere on the PCB, is what you'd need to know in order to hook up to a teensy. Then just program the teensy with TMK or QMK software and you're in business.

Mapping out the matrix isn't as hard as it sounds, and there are plenty of folks here willing to help.

Thanks for the reply! How do I know what pin to connect to Teensy once I map the matrix? Is there some guide you can link me I can follow or maybe guide that can help me figure it out?
Title: Re: Can I replace this old board with teensy++2.0?
Post by: Tactile on Sun, 07 February 2021, 20:48:04
Which pins to connect rows/column wires are your choice. When you're working with QMK (or another) firmware, there's a file where you specify what pins you've used, the size of your keyboard matrix, etc. Here's a random config.h file I grabbed out of my QMK source code folder. Here you can see where the matrix is dimensioned and the pins are defined.

As you read this keep in mind that you won't be starting from scratch. You'll look through the QMK source to find a keyboard of a similar size/layout as yours, modify a couple of files, and build the firmware for your board.
Code: [Select]
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef CONFIG_H
#define CONFIG_H

#include "config_common.h"

/* USB Device descriptor parameter */
#define VENDOR_ID       0xFEED
#define PRODUCT_ID      0x6060
#define DEVICE_VER      0x0003
#define MANUFACTURER    PHANTOM
#define PRODUCT         PHANTOM RGB MOD
#define DESCRIPTION     QMK keyboard firmware for PHANTOM TKL

/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 17

// ROWS: Top to bottom, COLS: Left to right
/* Row pin configuration
*/
#define MATRIX_ROW_PINS { B5, B4, B3, B2, B1, B0 }
/* Column pin configuration
 */
#define MATRIX_COL_PINS { D5, C7, C6, D4, D0, E6, F0, F1, F4, F5, F6, F7, D7, D6, D1, D2, D3 }
#define UNUSED_PINS

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION ROW2COL

/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST

/* Set 0 if debouncing isn't needed */
#define DEBOUNCING_DELAY 5

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

/* key combination for command */
#define IS_COMMAND() ( \
    keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)

/* Underlight configuration
 */
#define RGB_DI_PIN E2
#define RGBLIGHT_TIMER
#define RGBLED_NUM 20     // Number of LEDs
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17

/*
 * Feature disable options
 *  These options are also useful to firmware size reduction.
 */

/* disable debug print */
//#define NO_DEBUG

/* disable print */
//#define NO_PRINT

/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION

#endif

Title: Re: Can I replace this old board with teensy++2.0?
Post by: vuckale on Sun, 07 February 2021, 21:07:27
Which pins to connect rows/column wires are your choice. When you're working with QMK (or another) firmware, there's a file where you specify what pins you've used, the size of your keyboard matrix, etc. Here's a random config.h file I grabbed out of my QMK source code folder. Here you can see where the matrix is dimensioned and the pins are defined.

As you read this keep in mind that you won't be starting from scratch. You'll look through the QMK source to find a keyboard of a similar size/layout as yours, modify a couple of files, and build the firmware for your board.
Code: [Select]
/*
Copyright 2012 Jun Wako <wakojun@gmail.com>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef CONFIG_H
#define CONFIG_H

#include "config_common.h"

/* USB Device descriptor parameter */
#define VENDOR_ID       0xFEED
#define PRODUCT_ID      0x6060
#define DEVICE_VER      0x0003
#define MANUFACTURER    PHANTOM
#define PRODUCT         PHANTOM RGB MOD
#define DESCRIPTION     QMK keyboard firmware for PHANTOM TKL

/* key matrix size */
#define MATRIX_ROWS 6
#define MATRIX_COLS 17

// ROWS: Top to bottom, COLS: Left to right
/* Row pin configuration
*/
#define MATRIX_ROW_PINS { B5, B4, B3, B2, B1, B0 }
/* Column pin configuration
 */
#define MATRIX_COL_PINS { D5, C7, C6, D4, D0, E6, F0, F1, F4, F5, F6, F7, D7, D6, D1, D2, D3 }
#define UNUSED_PINS

/* COL2ROW or ROW2COL */
#define DIODE_DIRECTION ROW2COL

/* define if matrix has ghost */
//#define MATRIX_HAS_GHOST

/* Set 0 if debouncing isn't needed */
#define DEBOUNCING_DELAY 5

/* Mechanical locking support. Use KC_LCAP, KC_LNUM or KC_LSCR instead in keymap */
#define LOCKING_SUPPORT_ENABLE
/* Locking resynchronize hack */
#define LOCKING_RESYNC_ENABLE

/* key combination for command */
#define IS_COMMAND() ( \
    keyboard_report->mods == (MOD_BIT(KC_LSHIFT) | MOD_BIT(KC_RSHIFT)) \
)

/* Underlight configuration
 */
#define RGB_DI_PIN E2
#define RGBLIGHT_TIMER
#define RGBLED_NUM 20     // Number of LEDs
#define RGBLIGHT_HUE_STEP 10
#define RGBLIGHT_SAT_STEP 17
#define RGBLIGHT_VAL_STEP 17

/*
 * Feature disable options
 *  These options are also useful to firmware size reduction.
 */

/* disable debug print */
//#define NO_DEBUG

/* disable print */
//#define NO_PRINT

/* disable action features */
//#define NO_ACTION_LAYER
//#define NO_ACTION_TAPPING
//#define NO_ACTION_ONESHOT
//#define NO_ACTION_MACRO
//#define NO_ACTION_FUNCTION

#endif

Thanks for this! Will surely take a time to figure this out