Demoboard set in WishBoardI remember happy student years when there was a sea of free time. Golden times, when a boring couple could write a program or read a useful book. Or sit with a soldering iron or in deep debugging day for flight, without sleep.
These beautiful times of insane creativity ended when I received my diploma and got a full-time job. Then ended the glorious freelance and began the harsh everyday life. I had a persistent feeling that someone had stolen 11 hours from my life (two hours on the road, an hour for lunch and 8 hours of work). The saddest thing was that at work I was exhausting so much that I didn’t even have to think about any night vigils: I came, had supper and went to bed, otherwise tomorrow is a vegetable. In the end, such a situation ceased to suit me, and I began to think what to do.
In my hobby - electronics, I mostly make devices on microcontrollers. Assembly of the debugging scheme, as a rule, goes fairly quickly, the lion's share of time is writing and debugging programs for the controller. And at work I have such a resource as time (for example, lunch) and fast Internet. By this, the idea of remote debugging, ingenious in its simplicity, was born, and not only programs, but also hardware.
Concept
')
As the main operating system, I have Linux installed at home. This is a great advantage and also a disadvantage.
What I love about Linux is its complete versatility. The system is out of the box, there is everything you need right away for complete happiness: a compiler, an office, a certain development environment and a package of necessary drivers. A huge plus is convenient work from the console, with fast forwarding of individual windows.
The main disadvantages include its relatively low prevalence, and the programs for controllers written in gcc are much less than at the same Keil. Also for a long time I did not have a normal AVR programmer under Linux. Good programmers worked only in Windows, and under Wayne they worked somehow crookedly and obliquely. Everything changed radically when I abandoned the AVR and switched to AWPs with bootloaders.
So, what we need:
1. Remote access, with the ability to view various programs in graphical mode.
2. The ability to copy files and change them in real time.
3. Visual inspection.
4. Possibility of remote firmware
5. Remote emulation of keystrokes or other external events.
Plus I had an additional option:
6. The ability to remotely turn on the computer.
Implementation
For the second point, I use a fairly obvious, but not the best solution - Dropbox. Not the best, because it does not allow to control the versions of the programs that you write. My recommendations to those who will repeat themselves should be used for SVN software. It is much more convenient, and get rid of a headache in the future.
For the third item, I chose the LPC2103 microcontroller (see the first picture), which allows you to flash yourself through the UART. And there are already ready console programs in Linux, which are simply written in the Make-file, and it is flashed with one simple command.
make programRemote enable
Faithful fighting routerHowever, the most important and primary for me and my loved ones was that in my absence the computer should be turned off by default. Therefore, the implementation of Wake-on-lan was a priority. My computer is behind the Asus WL-520 GU router. I already wrote in the article
habrahabr.ru/blogs/easyelectronics/109395 about this router. In the Olegovskoy firmware, there is a default program called ether-wake. As parameters, the MAC address of the network card is substituted and the computer is turned on. I wrote a small script that, after switching on, starts pinging the computer in order to set the download time and the time when it will be possible to connect via SSH to my computer. The script looks like this
ether-wake 00: 1f: d0: 0b: 0b: 75
ping 192.168.1.109Now, to turn on the computer, it will be enough for me to connect, for example, using Putty to my router, run the script and wait for the pings to go:
[dlinyj @ WL-001E8C505364 root] $ ./wakeup.sh
PING 192.168.1.109 (192.168.1.109): 56 data bytes
84 bytes from 192.168.1.109: icmp_seq = 0 ttl = 64 time = 1.0 ms
84 bytes from 192.168.1.109: icmp_seq = 1 ttl = 64 time = 0.8 msRemote work
It should be noted that I use Linux at home, but at work, which is logical, due to a number of circumstances I use Windows XP. And if for probroski windows in Linux it is enough to connect the following command to the remote machine:
ssh user @ host –XSomething in Windows is not such a simple solution, and Putty alone is not enough. There are several options that I somehow use. The first option, and the most brutal, is to install Linux on the working machine too, which I actually did. But due to the fact that we have very well developed network services, as well as strong document management in the MS Office format, I had to transfer to Windows back. The second solution, similar to the first, but requires a lot of space on the hard disk - is installing Linux on a virtual machine.
The simplest thing is to use the Xming program, and I’m using this option right now. A description of how to do this can be found here
www.openkazan.info/Linux_Desktop_from_Microsoft_Windows-Xming-SSHNow it is possible to quickly run the graphical mode, for example, gedit, which well highlights the syntax (I don’t like to use console applications because they occupy the console). Or, for example, you can see the latest open tabs in the browser, the most frequent and necessary phenomenon. Usually for the night, I look for the programming material I need, and in the morning from work to a fresh mind it is good to handle. But it turns out that this is also the most important thing. Now there is a possibility of visual control!
Visual control
Agree, a special interest appears when there is an opportunity, how does your piece of iron flashing LEDs and get everything you want. And this possibility is in remote mode. It is logical that if you can forward the program windows, then you can also forward the window that displays the image from the webcam. To transfer the image, I used the program cheese. To make it convenient to place the webcam over the board, I just fixed it on the desk lamp
WebcamThe video of course is very slow, and far the transmission is not real-time, but you can see the blinking of the LEDs
The result of the program cheeseI want to note one nuance that in the light of sunlight - the glow of the diodes is completely invisible. By this I put in front of the board either a large sheet of cardboard or a book so that they create a shadow.
Push the buttons
Who is engaged in electronics, knows that one of the main functions of the controller is the processing of environmental events. And to debug these events - they need to be created. There are many options for implementation - hang a second controller, or an analog sensor, etc. I also had to process a short pulse, for working off the program of the external interrupt handler. For this, I took the old block external relay.
Relay blockThis thing is left with my first job. There is a chip FT232BM, which is defined as a virtual COM port, controller Attiny2313 and a block of three relays. This is all managed through a terminal program. The big letter "A" turns on the first relay, the "B" on the second, and so on, the small ones turn off respectively. Alternatively, you can find some masterkit kits, or even do it yourself.
Conclusion
My post is a concept. It should not be regarded as the truth of last resort. Windows can be used instead of Linux; instead of Dropbox you can, and you should, use SVN; instead of a powerful relay unit, you can use the second microcontroller, which will emulate the press. More intelligent people suggest that routers with Ogov firmware can also hook up the camera. In general, do not be afraid to experiment and remember that if you are an office rat and you cannot bring your devil-device to work and poison all employees with rosin, then this does not mean that at work you cannot be engaged in programming and electronics.
PS On GCC, I was never able to debug external interrupt handling on the LPC2103 controller. If someone wrote on gcc for lpc21 ** controllers, then I would be grateful for any help I could, because I still could not find working examples and there is no one who can help me.