Month: January 2014

Site com dicas importantes de como fazer seu CNC

Este site reune as informações necessárias para você entender os conceitos e funcionamento de um CNC:
http://lcamtuf.coredump.cx/gcnc/

Este outro site tenta ir direto à construção, explicando a vantagem e desvantagem de cada design:
http://www.cncroutersource.com/homemade-cnc-router.html

Neste site você encontra dicas de como fazer um CNC com perfil de alumínio (clique nas TABs para ler cada seção), no final ele coloca à venda as instruções por $25,00 :
http://8020cnc.com/home

Este é um projeto disponível no Thingiverse de um CNC com perfil de alumínio e fuso de esferas:
http://www.thingiverse.com/thing:41594

Este cara comprou um kit CNC achando que seria mais fácil, porém ele passou por vários problemas para monta-lo e então resolveu compartilhar os problemas e as soluções:
http://www.limpkin.fr/index.php?post/2013/09/29/Entering-the-CNC-world-with-a-probotix-fireball

Se você já fez seu CNC e agora quer desenvolver peças com ele ou até vender serviço, este site tem algumas dicas que podem te ajudar nesta tarefa:
http://www.omwcorp.com/partdesign.html

Este site explica o que é o backlash e como elimina-lo:
http://www.cnccookbook.com/CCBacklash1.htm

Este link acima faz parte do Dicionário de CNC:
http://www.cnccookbook.com/MTCNCDictionary.htm

Site com poucas informações, mas pode ser útil para algumas pessoas:
http://www.technologystudent.com/cam/camex.htm

Site com informações sobre CNC:
http://whatisacnc.com/driver-board/tb6560/

Possíveis problemas que você pode ter com seu CNC e como resolver:
http://www.wired.com/2012/10/you-suck-at-using-a-cnc-router/

Outros problemas que você pode ter com CNC principalmente para fresar metais:
http://blog.cnccookbook.com/2012/02/22/10-things-beginning-cnc-milling-machine-users-need-to-succeed/

Flashing Spark Core when DFU fails

I received my Spark Core module, but when plugged it on my computer the LED started to blink in purple color (BLUE and RED LEDs was on) and nothing was working.

Unfortunately this LED color error is neither documented here or at spark core forum.

Then I decided to compile to core-firmware and flash it again using OpenOCD with STLink-v2 as SWD programmer.

First clone Spark Core repositories:

$ git clone https://github.com/spark/core-firmware.git
$ git clone https://github.com/spark/core-common-lib.git
$ git clone https://github.com/spark/core-communication-lib.git

Then enter inside core-firmware/build/ and edit the makefile file replacing the linker script “linker_stm32f10x_md_dfu.ld” by “linker_stm32f10x_md.ld” this way the entry point will be 0x08000000 instead of 0x08500000.

Then execute the make command:

$ make

When the compilation is finished these files will be created:

Invoking: ARM GNU Create Flash Image
arm-none-eabi-objcopy -O binary core-firmware.elf core-firmware.bin

Invoking: ARM GNU Create Flash Image
arm-none-eabi-objcopy -O ihex core-firmware.elf core-firmware.hex

Invoking: ARM GNU Print Size
arm-none-eabi-size --format=berkeley core-firmware.elf
   text	   data	    bss	    dec	    hex	filename
  65356	   2920	   6912	  75188	  125b4	core-firmware.elf

Copy the core-firmware.bin to your home renaming it to spark.bin to make it easy to type on GDB:

$ cp core-firmware.bin /home/username/spark.bin

Now you need to connect some wires from SWD programmer to Spark Core board…
You just need to connect STLink-v2 programmer pins this way:

STLink-v2        Spark Core
-----------------------------
RESET                  RST
GND                    GND
SWDIO                  D7
SWDCLK                 D6

Then execute:

# openocd -f interface/stlink-v2.cfg -f target/stm32f1x_stlink.cfg

Then open another terminal and execute:

$ telnet 127.0.0.1 4444
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Open On-Chip Debugger

> reset halt
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0xfffffffe msp: 0xfffffffc

> flash probe 0
device id = 0x20036410
flash size = 128kbytes
flash 'stm32f1x' found at 0x08000000

> stm32f1x mass_erase 0
stm32x mass erase complete

> flash write_image /home/username/spark.bin 0x08000000
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000003a msp: 0xfffffffc
wrote 68280 bytes from file /home/username/spark.bin in 2.082684s (32.016 KiB/s)

> reset run

> exit

Note: This is almost the same way I flashed my STM32VLDiscovery few days ago:
https://acassis.wordpress.com/2014/01/13/using-a-stm32f4discovery-board-to-flash-stm32f100rb-from-stm32vldiscovery/

The board now started with the LED in WHITE (RED/GREEN/BLUE turned on) instead of purple, but nothing is working.

Then I decided download and compile NuttX to Spark Core, after compilation I copied nuttx.bin to my home directory and executed the above commands (just replacing spark.bin to nuttx.bin).

Now the LED should turn on with GREEN color, it means NuttX is running…

To have access to NuttX terminal (NSH) you just use a 3.3V USB/Serial adapter and to connect three wires: GND, TX and RX. Open a serial console configured to 115200 8N1 and voila!

Using a STM32F4Discovery board to flash STM32F100RB from STM32VLDiscovery

Almost 2 years ago I replaced the ST-Link firmware of STM32VLDiscovery to become a Versalon programmer.

It worked fine to program some boards, but today it didn’t work to program the STM32F100RB target chip from itself STM32VLDiscovery. I ported NuttX to run on STM32VLDiscover, but was facing many issues to store the final nuttx.bin firmware inside STM32F100RB.

I just realized I have a STM32F4Discovery board (with its built-in STLink-v2) which is supported by OpenOCD, then I decided to test the idea of using STLink-v2 to flash STM32F100RB directly.

It was easy, just removed the 0R resistors from SB11, SB17, SB18 and soldered some wires from STM32F4Discovery’s CN2 to these SBx pins (bottom side of SB11 and left side of SB17 and SB18. Also I need to solder connect the GND pins of both boards.

The STM32F4Discovery’s CN2 pinout is presented in this post.

You need to open a terminal and execute:

# openocd -f interface/stlink-v2.cfg -f target/stm32f1x_stlink.cfg

Open On-Chip Debugger 0.8.0-dev-00291-g624e74e (2013-12-29-15:30)
Licensed under GNU GPL v2
For bug reports, read
	http://openocd.sourceforge.net/doc/doxygen/bugs.html
Info : This adapter doesn't support configurable speed
Info : STLINK v2 JTAG v17 API v2 SWIM v0 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 2.912456
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints

Then open other terminal, make sure the your nuttx.bin is in the same directory you are, and execute these commands:

$ telnet 127.0.0.1 4444
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
Open On-Chip Debugger

> reset halt
target state: halted
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0800015c msp: 0x20000cfc

> flash probe 0
device id = 0x10016420
flash size = 128kbytes
device id = 0x10016420
flash size = 128kbytes
flash 'stm32f1x' found at 0x08000000

> stm32f1x mass_erase 0
stm32x mass erase complete

> flash write_image nuttx.bin 0x08000000 
target state: halted
target halted due to breakpoint, current mode: Thread 
xPSR: 0x61000000 pc: 0x2000003a msp: 0x20000cfc
wrote 78128 bytes from file nuttx.bin in 2.361482s (32.309 KiB/s)

> reset run

Easy, right?

Update: new version of OpenOCD (i.e. 0.8.0) doesn’t work with above commands. Then you need to return to old version:

$ git checkout 215c41c0174e94ab00b36a7d56a054cdd7f30dd0

Site com informações sobre TouchPad Synaptics

Este dois sites possuem informacoes interessantes sobre como usar a interface PS/2 dos touchpads de notebooks. Infelizmente não consegui fazer o touchpad (que retirei de um HP DV6449) funcionar corretamente, não funcionou nem ligando diretamente na porta PS2 do computador e nem ligando no arduino. Seguem abaixo os links:

http://sparktronics.blogspot.com.br/2008/05/synaptics-t1004-based-touchpad-to-ps2.html

http://diy.viktak.com/2012/05/laptop-touchpadmouse-pad-salvaging.html

Vou testar depois em outro modelo de touchpad para ver se funciona…

How to download youtube video without installing software

If you want to download youtube videos, this tips is what you want.

All you need to do is replace the youtube URL http://www.youtube.com by http://www.voobys.com

For example to download this video:

 http://www.youtube.com/watch?v=nuzRsXKm_NQ 

You need to enter this URL

 http://www.voobys.com/watch?v=nuzRsXKm_NQ 

Give access the plugin and just click on video resolution you want to download.

Very easy to do!

How to execute more than one command in the GDB terminal

So, are you trying to execute more than one command in the same line of GDB?

Unfortunately it will NOT work this way:

(gdb) mon si ; mon regs

GDB doesn't recognize the above command as two commands.

Fortunately you can execute these two commands creating a definition (like a MACRO) this way:

(gdb) define sishow
> mon si
> mon regs
> end

I'm creating the "sishow" command, then when I type it in the terminal it will execute "mon si" and then "mon regs". These commands will do the step instruction and show the registers to me.