Showing posts with label CP2120. Show all posts
Showing posts with label CP2120. Show all posts

Saturday, December 29, 2018

Setting up atmega328 and CP2102 USB Module

For a while I've been playing around with different arduino compatible cards. I've been using JOY-IT UNO, Nano v3.0 atmega328P with integrated USB and now the atmega328P Mini which needs external USB Module to upload your sketches. Setting up is a bit complicated so I'll write instructions here so it will be easier next time, or if someone else wants to do the same thing. 

First you need to get drivers for you CP2102 module as Windows does not recognize it automatically. Silicon Labs has universal drivers for different operating systems. 


After successful installation you can see the port in device manager. Then you need to setup you breadboard so you have USB Module correctly connected to your atmega328P card. 

Note that USB module I'm using has power connections for 5V and 3,3V. My atMega card is 5V version so I've connected VCC into 5V. Should you have 3,3V card, you need to use 3,3V connection. Also If you have a reset (RST) instead of DTR in your USB card, you need to modify connection a bit. 


When you are done with wiring, you need to setup your IDE to support you connected USB device. Connect the USB cable and make sure PWR lights on both cards light up.  

I'm using Arduino IDE, in which you need to go to "Tools" - menu. Select port: "COM7" or whatever your device installed into earlier. Select card: "Arduino Pro or Arduino Pro Midi" and processor: "ATMega328P (5V 16MHz)". Should you use 8MHz or 3,3V card, make sure you make a correct selection, there were 4 versions when I wrote this. 

When you are finished, use for example this faster led_blink sketch to test it:

void setup() {                
  pinMode(13, OUTPUT);
}
void loop() {
      digitalWrite(13, LOW); // LED off
      delay(100);
      digitalWrite(13, HIGH);// LED on
      delay(100);

}

Upload sketch into your card and voila, you have a really small arduino compatible card ready for whatever you are going to do with it.






Testing private Methods in C#

Testing private methods in a C# can be a bit challenging. This is just to remember what's needed. [TestClass] private MyUnit _myUni...