1
1
12345 123452015-07-17 01:03:05
Do it yourself
12345 12345, 2015-07-17 01:03:05

Turning on the LED via USB?

I'm trying to repeat what was done in this article . My microcontroller is ATTINY45-20PU.
jjhaZxxNPmY.jpgAt first I tried to compile hex from the sources in the article, cursed that some variables should be constants, assembled it, flashed the controller, connected it - "USB device not recognized", and went into an on-off cycle (judging by the sounds). In the source code, I had to add otherwise it did not compile, as well as . Compiled in AtmelStudio. Then I decided to upload a hex file from the archive in the article, I connect it - it doesn’t show any signs of life at all. The VCC and GND pins of the controller are 3.5V, is this normal? I also tried, after initializing the port direction, to add the inclusion of the leg on which the LED
#define F_CPU 1650000
#define USB_CFG_CLOCK_KHZ 16500

sbi(LED_PORT_DDR,LED_BIT);			/* делаем ножку, куда подключен LED, выходом */
sbi(LED_PORT_OUTPUT,LED_BIT);

works, the LED turns on when power is applied.
Tell me where to dig?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Pukhov, 2015-07-17
@Neuroware

judging by the fact that the author closed his article, apparently not everything was a bundle with it, now without knowing what you were doing it is impossible to help. In particular, it is not at all clear how you send signals to the device. For a horse in a vacuum, you can pick up diodes for less / more power, sometimes it helps to solve the "device not defined" problem.

S
svd71, 2015-07-17
@svd71

I can't read the article due to missing pictures. But looking at the bredboard, I probably see a possible reason. Not all USBs are equally useful. For such devices, you need to show USB that the device has version 1.1. This is done by pulling up the signal with a D-resistor to the power supply, so that when the device is turned on, such recognition takes place. In addition, for the same reason, device signals may not be recognized on some USB ports even on one computer. This is generally a separate topic of discussion on how to properly pair the controller with USB. from a schematic point of view. I usually spend a lot of time on this for each of my devices.
Secondly, such circuits are usually built on the v-usb library. They have a simple limitation: it is better not to use a frequency above 16 MHz - very fast for this class of devices. the most optimal is 12 MHz.
The costants are also a mess. F_CPU is usually set in Hertz. That is, the value of 16500 is no longer correct. Sometimes they even add units of measure to the constant so that the compiler doesn't go crazy with the number of zeros: #define F_CPU 12000000UL.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question