I am using ATMEGA128 to communicate with another device. For this I am using SPI with ATMEGA128 as slave. I use SS, SCK and MOSI pins. The problem I am facing is that when I have to download program, I have to disconnect SPI pins. The ATMEGA128 module I am using uses TXD0, RXD0, SCK(PB1) pins to download program. Why am I facing this problem ? Is it because SPI and downloading circuit uses same SCK pins ? Is there any way to avoid disconnecting SPI pins ?
Does the other device have a chip select input, or could you add one on its VCC pins? If so, you could tie this device's CS (active low) input to an extra AVR port pin with an external pull-up resistor attached (maybe 10k ohms or so), then set this AVR pin low at the start of your code somewhere. The device will be disabled by the external pull-up until programming of the AVR is finished and your code re-enables it when run.
Is it because SPI and downloading circuit uses same SCK pins ?
Yes, you have to prevent any other device from driving the SPI lines during programming.
Is there any way to avoid disconnecting SPI pins ?
Yes. To avoid driver contention, a series resistor should be placed on each of the three dedicated lines if there is a possibility that external circuitry could be driving these lines.
See my answer here.
Related
Is there any way I can apply stimulus signals on my FPGA board from my PC itself, and view the output of hardware in any simulation software? I am working on Spartan 3A development board provided by numato labs (elbert V2)
https://numato.com/product/elbert-v2-spartan-3a-fpga-development-board/
It is a relatively small board with few peripherals, so the number of LEDs for output and push-buttons for input is quite less.
I am a newbie to FPGAs but have sound knowledge on verilog. Please help me out with this
Thanks
The board does not have an physical interface intended for use as wired connection/communications (no ethernet, no usb, no uart, etc) to a PC.
These are the easiest ways I can think of for an 'elbert V2' board to communicate with a PC:
The board has a micro SD connector to access files on the micro SD interface. Those files could be accessed by a Verilog simulation.
A USB to UART adapter could be used with the boards GPIO interface.
Here is an example:
https://www.amazon.com/3-3V-UART-Serial-Cable-TTL-232R-3V3/dp/B078GMQPLT
The cable provides 3.3V TTL and the board has 3.3V gpio ports so that is encouraging. Probably just need to connect 3 wires tx/rx/ground.
You would need to design or find UART RTL IP for the FPGA.
Designing the UART would be a good intermediate level Verilog project.
Use procom or similar software on the PC to communicate with the USB/UART com port on the PC and a file. Verilog simulations can access the data in the file.
I have an mcu (not relevant which one) and want to control the SWD reset pin to ground. On the debug port is also connected a segger j-link. How can this savely be done with the segger probe also attached?
The segger probe use this pin as open drain. When the segger probe use the pin it drives it to LOW with the following schematic:
I connected the SWD reset pin to a free gpio and per default I define the port as IN. If now I want to reset the mcu I redefine the gpio to OUT with pinlevel LOW.
It works without any issue.
I am new to FPGA and I am trying to get a working JTAG setup on Lattice iCE40 FPGA.
The board I'm using is from Olimex and has iCE40-HX8K FPGA.
I'm using urjtag as PC application and tried with DirtJTAG and USB Blaster clones as programmer (flashed onto STM32 BluePill board).
Olimex board didn't have populated pull-up resistors for JTAG so I soldered them (10k for TMS, TDI and TCK).
But the end result is the same: I cannot get jtag to recognize FPGA, the error is:
jtag> cable UsbBlaster
Connected to libftdi driver.
jtag> detect
warning: TDO seems to be stuck at 1
Checked pinout of the JTAG connector and it's correct. Multimeter tests show that there is no short-circuit, no solder bridges, pullups are correct value and working and as expceted.
Tried my setup with Altera FPGA board and it's working, it will detect the FPGA.
Also, tried eBay UsbBlaster clone and it's not working on iCE40, but works for Altera FPGA.
I can flash the external flash (with other tools and programmer), but I want to be able to use JTAG so I can flash onboard SRAM instead.
Any ideas/hints what might be wrong/what to try next?
iCE40 FPGAs do not have a JTAG interface.
I was working on a project using FPGA and Arduino, in which i have to show for how long my fpga device was OFF if it was so. I am using BASYS3 FPGA board. Once i switch off my FPGA the program is getting erased.
BASYS3 has quad spi FLASH onboard, fpga can be configured using stream stored there.
Follow instructions here: https://reference.digilentinc.com/learn/programmable-logic/tutorials/basys-3-programming-guide/start
I am new in this. Bought Atmega8a mcu to have some fun with it. But I am unable to program it using arduino uno rev-3. Haven't used any external parts to program it. Just connected the chip as below:
Arduino pin 10 to chip pin rst,
Pin 11 to MOSI,
Pin 12 to MISO,
Pin 13 to SCK,
Connected vcc and gnd to chip pin 7 & 8,
Also used an 10 uf cap, arduino rst to gnd.
Trying to upload the bootloader using arduino ide 1.6.9. It says:
avrdude: Yikes! Invalid device signature.
Double check connections and try again, or use -F to override this check
Am I missing something?
Most minimal AVR setups include a 10k pull-up resistor on the reset pin. Are you sure you don't need one?
Arduino target cpu (or variant) must be ATMega8A.
"Invalid signature" is not so verbose - it says nothing. Enable verbose log for avrdude in Arduino setting.
If signature is slightly different from actual one, it's selected variant problem.
If it's something like 0xFF or 0x00 it's usualy wiring, reset or missing xtal problem.
Bootloader needs correct xtal/resonator (AVR runs from internal 8MHz clock and it's divided by factor 8 by default, but after flashing bootloader it'll be set to crystal oscilator - depends on target/variant)
Remove cap from RST, it might be slowing down reset and cause invalid reading
Currently there's no arduino board with atmega8a as the main microcontroller.
You forgot about pins 20 and 22 -- you must connect them to VCC and GND even if you're not going to use ADC.
EDIT:
Ad. 1. It would be possible to add support for atmega8a to arduino ide, by modifying hardware/arduino/avr/boards.txt file and compiling a bootloader for atmega8a.