Producción y Electrónica
lunes, 5 de enero de 2015
domingo, 17 de agosto de 2014
Digital Snake Wing (Part 1) - PLL Test
As you may or may not know, I'm currently working on a Papilio Wing that streams and receives multiple channels of audio over Ethernet using the 5 layer TCP/IP model. The wing includes as an ADC a PCM1807 with a companion PLL1705 to generate the sampling clock frequencies. As a DAC it uses a MAX5556 and as the ethernet controller the ENC28J60.
Here is a render of the PCB and the actual PCB
By the way... I manufactured my PCBs with Elecrow and I have to say I am impressed with their quality. They are really cheap and really good :D.
Anyway... I've just received my Papilio and I'll be posting stuff as I progress.
The first thing I did was to be shure that the PLL was working, so I made a little test module in VHDL that turned on and off a couple of LEDs synchronously with the PLL output clock. Here is the code. Note tha it uses an IP module from Xilinx called DCM. This module is like a programmable PLL and is the one that converts the input 32MHz clock to the 27MHz clock for the PLL1805. You can get more info here http://papilio.cc/index.php?n=Papilio.DigitalClockManager
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity Test_PLL is
port(
CK32 : in STD_LOGIC; -- Main Papilio Clock (32MHz)
CK27 : out STD_LOGIC; -- Clock from the Papilio to the PLL
CK384fs : in STD_LOGIC; -- Clock from the PLL to the Papilio
LED1 : out STD_LOGIC;
LED2 : out STD_LOGIC;
BTN1 : in STD_LOGIC;
BTN2 : in STD_LOGIC
);
end Test_PLL;
architecture Behavioral of Test_PLL is
COMPONENT DCM32to27
PORT(
CLKIN_IN : IN std_logic;
CLKFX_OUT : OUT std_logic;
CLKIN_IBUFG_OUT : OUT std_logic;
CLK0_OUT : OUT std_logic
);
END COMPONENT;
signal led1_signal : STD_LOGIC := '0';
signal led2_signal : STD_LOGIC := '1';
begin
Inst_DCM32to27: DCM32to27 PORT MAP(
CLKIN_IN => CK32,
CLKFX_OUT => CK27,
CLKIN_IBUFG_OUT => open,
CLK0_OUT => open
);
-- This process reacts to one of the output clocks of the PLL
blink: PROCESS(CK384fs)
variable counter : INTEGER := 0;
BEGIN
IF(rising_edge(CK384fs)) THEN
IF(BTN1 = '1' and BTN2 = '0') THEN -- Button 1 pressed
counter := counter + 1;
IF(counter >= 1700000) THEN
led1_signal <= not(led1_signal);
led2_signal <= not(led2_signal);
counter := 0;
END IF;
ELSIF(BTN1 = '0' and BTN2 = '1') THEN -- Button 2 pressed
counter := counter + 1;
IF(counter >= 17000000) THEN
led1_signal <= not(led1_signal);
led2_signal <= not(led2_signal);
counter := 0;
END IF;
END IF;
END IF;
END PROCESS;
LED1 <= led1_signal;
LED2 <= led2_signal;
end Behavioral;
You can also download the Xilinx project from my Github https://github.com/DiegoRosales/VHDL_Modules.git.
lunes, 7 de julio de 2014
DAC Wing for the Papilio Platform
jueves, 20 de febrero de 2014
Hercules Launchpad #8 - Nokia 5110 LCD Display (Part 3 - CCS Setup)
Step 1
Create a new project just like we've done it before.
Step 2
Copy the .h and .c files to their respective folders inside the project (include and source, respectively)
OR
Right-click on the root folder inside CCS and select "Add files...". Then select the library files you downloaded like this
miércoles, 19 de febrero de 2014
Hercules Launchpad #7 - Nokia 5110 LCD Display (Part 2 - HALcoGen configuration)
domingo, 26 de enero de 2014
Hercules Launchpad #6 - Nokia 5110 LCD Display (Part 1 - The basics)
- !Reset (RST)
- !Chip Enable (CE)
- Data / !Command (DC)
- Data In / MOSI (DIN)
- Clock signal (CLK)
- Main source input (Vcc)
- Backlight voltage (LIGHT)
- Ground (GND)
The very first thing to do is to reset the display... at least according to the datasheet, see?
According to the datasheet, the reset pulse can be low even before we power up the display, but the time between the power up and the reset pulse must not exceed 30ms. The pulse width of the reset signal must be at least 100ns, which is low enough for us to not worry.
The second thing to do whith it is to initialize the display. This is achieved by sending a series of commands that set up the contrast and other various things. We will see the details of that in the code.
Finally, the last thing to do is to start sending display data.
Now let's discuss the data format.
As I said before, the display controller operates with an SPI interface. This means that it requires a Chip Enable (CE), a Clock Signal (CLK) and one or two data signals (MISO, MOSI). Since this display does not return any data, we only have to worry about one data signal (MOSI).
Another important thing is that the data is sent to the display in packets of 8 bits, with the most significant bit (MSB) first.
The way it is transmitted is the following:
In this case, SDIN is the equivalent of MOSI, SCLK is the Clock signal and SCE is the Chip Enable signal. D/C is the signal that indicates whether we are sending data or commands.
If we want to send several bytes, we just need to keep the SCE low and the clock signal going.
Also, as you can see, each bit is sent in one clock cycle. Not two, not three but one!
Now... let's talk about how the data is displayed on the screen. The micro controller inside the screen has an internal RAM to which we send the display data. This RAM is divided in blocks of 8 bits forming the rows. Therefore it has only 6 rows. It looks like this
Each bit corresponds to a pixel, but we can only manipulate individual bytes, not bits. If we wanted to manipulate a single bit, we would need to have a buffer inside our controller and modify the individual bit there, and then re-send the byte that holds our bit, or just re-send the entire display.
Ok, so pretty much this is what you need to know before you start making your own code!
But before we get into the code, let me tell you a couple of things about the Hercules Launchpad.
The connection I made with the display was the following
- !Reset (RST) ---> N2HET[14]
!Chip Enable (CE) ---> N2HET[12]- !Chip Enable (CE) ---> MIBSPI1nCS1 or GIOA[6] for compatibility with standard boosterpack pinout.
- Data/!Command (DC) ---> N2HET[10]
Data IN (DIN) ---> N2HET[6]- Data IN (DIN) ---> MIBSPI1SIMO/ADVERT
Clock signal ---> N2HET[4]- Clock signal ---> MIBSPI1CLK
- Vcc (VCC) ---> N2HET[2]
- LEDs (LIGHT) ---> N2HET[0]
- Ground (GND) ---> GND
https://www.sparkfun.com/datasheets/LCD/Monochrome/Nokia5110.pdf
Useful videos
http://www.youtube.com/watch?v=M9XBFomX7JI
http://www.youtube.com/watch?v=RAlZ1DHw03g
My Github
https://github.com/DiegoRosales
lunes, 6 de enero de 2014
Hercules Launchpad #5 - Comunicación Serial (SCI / Serial Communications Interface)
- Programación y depuración del procesador a través de la emulación JTAG
- Comunicación serial usando los protocolos UART