M
M
Michael2016-04-02 01:51:59
Arduino
Michael, 2016-04-02 01:51:59

How to setup atmega32u4?

In general, the essence is as follows: atmega32u4 is chosen for the sake of iron usb, and it works.
I am writing C code in CodeVisionAVR and trying to implement the following - when connected to a computer, it connects and is recognized as a keyboard (there are no problems with this) and runs the code, and with a simple power supply (from a usb adapter, for example) it just runs the code. In which direction to dig?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael, 2016-04-06
@Inkvizitor66

It seems that due to the curvature of my language and the specificity of the topic, no one cares about this issue, well, it doesn’t matter.
The code does not start when power is applied without an active usb connection for 1 simple reason:

// USB Controller initialization in device mode
// Note: This function also initializes the PLL
usb_init_device(&usb_config);

// Global enable interrupts
#asm("sei")

// Wait for the USB device to be enumerated by the host
//while (!usb_enumerated);

// Wait 1.5 seconds for the operating system to
// load any drivers needed by the USB device
delay_ms(1500);

namely, this line
, just the controller was waiting for the connection and did not go further ... I take this opportunity to say hello to my attentiveness and wizzard from kodvizhnavr

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question