mitxela.com forum
Welcome. Please log in or register.

attiny85 morse code
rilliam Posted: 6 Feb 2019, 08:38 AM
Avatar


Member
Posts: 1
Joined: 6-February 19
What changes if any are needed to use morse_code_usb_keyboard_mk_ii code on a digispark atiny85? Should I be editing the usbconfig.h file? I am not sure what is meant by "bit in the port".

#define USB_CFG_DMINUS_BIT 0
/* This is the bit number in USB_CFG_IOPORT where the USB D- line is connected.
* This may be any bit in the port.
*/
#define USB_CFG_DPLUS_BIT 2
/* This is the bit number in USB_CFG_IOPORT where the USB D+ line is connected.
* This may be any bit in the port. Please note that D+ must also be connected
* to interrupt pin INT0!
*/

(User posted image)


Last edit by rilliam at 6 Feb 2019, 09:13 AM

-------------
[top]
mit Posted: 6 Feb 2019, 01:38 PM
Avatar
yeah whatever

Admin
Posts: 538
Joined: 4-May 16
I've not used the digispark so I can't give a definite answer.

The "bit in the port" is refering to the i/o port. It's an 8-bit register with each pin PB1, PB2, etc controlled as separate bits in that byte.

V-USB (which both the digispark and the morsekey use) needs to have one of those lines connected to INT0 (not to be confused with PCINT0) which if you look at the datasheet for the ATTiny85, is on PB2:

(User posted image)


In the schematic you've posted, they seem to have connected the USB data lines to PB3 and PB4. It's probable that they're using a version of V-USB that has relaxed this requirement. I think I remember reading about micronucleus (the usb bootloader) not needing interrupts.

I think you have two options, either research what V-USB version is used by the digispark and try and port the code to use that, or start a new project within the digispark's IDE using their recommended way of doing USB, and copy and paste the bulk of the morsekey code into it.


-------------
[top]
DAVID Posted: 7 Feb 2019, 12:26 AM
Avatar
I love mcus

Member
Posts: 237
Joined: 10-September 17
you must modify the code so instead of using interrupts (as mit previously said) and the use the pin change interrupts, so i would recommend to just use the original schematic. Also i have test the micro nucleus boot loader and it is a nightmare to use it on windows (mainly because the driver) and when flashing hex files from other place that is not the arduino IDE (such as some projects from mit himself example the attiny85 musical greeting card:https://mitxela.com/projects/musical_card) just wont work well.

-------------
[top]

Sign in to post a reply.