On the Arduino Nano V3, I am trying to get an LED driver (TLC5960) and two analog to digital (ADC) converters (MCP3208) to work together. The LED driver is on the same pins as this guide. The ADCs are assigned to different pins than the LED driver. I found that the LED driver conflicts with the SPI communication interface according to the comment:
Tlc.init(); //interferes with other SPI
but I'm not sure what to do about it since if this is not called, the LED driver does not work. It seems to be true, however, since if I comment out all of the LED driver related lines in my code, the ADCs work.
Also, I am using bit banging to communicate to the MCP3208.
If you look at the code, you'll see that tlc_config.h contains options relating to the communication and connection with the TLC'. Simply edit the options within that file to suit your needs.
Related
I have arduino atmega2560 when i upload blink code than it shows error
avrdude: stk500v2_ReceiveMessage(): timeout.
I have checked the COM port is correct also that the driver is correctly installed.
Why would I be receiving a timeout error?
The possible reasons:
Faulty communication cable
Wrong com port selected
Wrong device model selected
Baud rate settings
Driver related issues
I think your arduino got bricked. But first try to reconnect it and upload your program.
Second try to disconnect any rx or tx pin connected. Third if your arduino is bricked, try to check this article for full solution of bricked arduino. Programmer is not responding arduino
Context
I have accidentally uploaded some ARM Cortex M0-cmis files (core-cmFunc.h and core_cmInstr.h) to the STM32F407VG discovery board. After I noticed my mistake, I tried to undo it by changing my code and upload it again... but it said it couldn't make connection.
What I already tried
I've tried to get passed the USART interface of the discovery board by uploading the code directly on the ARM Coretex M4 chip via the bootloader. I connected BOOT0 to VDD and PB2(=BOOT1) to GND so the chip starts up in the Pattern1-mode. Then I connected PA9(=Tx) and PA10(=Rx) to an USB to TTL cable (by the use of a RS-232 chip in the cable) and reset the device. I started the "Flash Loader Demonstrator" from ST to make connection with the board (I've done this before and it worked). But that didn't made connection either.
Extra information
The Windows filemanager "sees" the ARM Cortex M4 file when it gets connected to the PC;
Led LD7 emits green light when the board is powered;
Led LD1 emits red light;
Does someone knows how I can factory-reset the flashmemmory of the STM32F4 so it acts at it should again?
After some trial and error I've come to the conclusion that I accidentally activated the OTG_VBUS with my code. I couldn't upload another code because that bus was active on PA9(TX of USART2). It seems that the VBUS was held active, even in bootloader mode.
PA9 connected to VBUS
The solution to this problem was the use of another bootloader interface, I used USART3 on PB10/11, but you could also use PC10/11. After I uploaded a dummy code in that manner, I
was able to upload codes with the Coocox-IDE again.
Other Bootloader interfaces
I don't have much konwledge in electronics. i wanted to turn on/off led connected to usb port using program. usb port consists 4 line (data+,data-,voltage ,ground) if i connect voltage and ground lines to led , it will glow. i've been searching on internet this issue and i find that it is not possible to control led connected to usb using program because supply over datapin is too low which can not be used to tun on off led.
but what if i connect my led to vol and ground pin and control the entire power supply of usb port , i guess it is possible to control led using program. there is a way to disable and enable power supply over usb port.
i also want to know is it bad to follow this approach. does it damage usb controller to frequently enable/disable power supply.
Algo :
a = Get_input_from_user() ;
if(a=="ON")
turn power supply of usb port ON.
else
turn power supply of usb port OFF.
this thing is certainly possible using extra hardwares, i don't want to use any extra hardware.
The power for a computer's USB ports is generally not software controllable. In most cases, the power pins of your USB ports are wired directly to the 5V rail of your power supply (usually through a polyfuse), so there is no way to switch them on and off.
Some powered USB hubs do support switching power to their ports, but you said that you didn't want to use any extra hardware, so you're out of luck.
you can use any basic Arduino board to do this there is a complete IDE free and a LOT of sample code that will do what you want out of the box
you can also use a COOL board.
Arduino Compatible code is available for the Teensy
Software Development Tools HERE
You can use an external power supply (the Vcc and GND pins of the USB port in this case) with a resistor to power the diode and connect a transistor in the middle working as interruptor. Then, yo connect the base and emisor to de data+ and data- of the USB port.
this page doesnt let me upload images.
Sorry for the quality of the drawing but all I have on the computer is paint.
For a more stable performance make sure to make R1 low enough so that transistor is on saturation mode when data pins are ON but not so low that transistor gets burnt (I dont really know what is the voltage level of the data pins on the USB port, sorry).
To choose a proper value of R2, you need to know the current you need to power your diode. It's calculated acording to Ohm law:
Idiode = (Vcc - Vce,sat - Vd) / R2.
Where Vce,sat is potencial diference between colector and emisor when transistor is on saturation mode (it is found on the transistor datasheet on the manufacturer webpage, usually around 0.2V) and Vd is the normalized potencial difference of the diode (the same, but this time around 0.6V).
Note that data- and GND pins are connected. I am 99% sure that this won't harm your USB port, but use it at your own risk.
I would test it out using another external power source first anyways, just to make sure you connected everything properly.
I'm going to write an SPI driver for an ARM devlopment board. It is not used with Linux.
Yesterday, I read the QSPI driver that Xilinx provided and I tried it successfully. However, I would really like to write my own SPI driver.
Here are my questions:
What is the difference between QSPI and SPI on usage?
If I write a driver based on QSPI, will it work?
If I write a driver from scratch, what is the basic procedure (READ / WRITE / INITIALIZE)?
And finally, why must SPI send and receive at the same time?
Thanks everybody.
I think it may be easier to start with your last question first.
Why must SPI send and receive at the same time?
The easy answer is that it is part of the protocol. As data is shifted out on the MOSI line from the Master to the Slave, the data in the Slave's buffer is shifted to the Master on the MISO line. This allows the hardware to use a single register in each device for both the data being sent and the data being received. There is a good diagram of the process here:
http://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bus
The not so easy answer is that SPI is not a well defined standard. There are different types of implementation depending on the devices you are using. There is even a variant where the MOSI and MISO lines are combined and used in a bi-directional manner (3-wire SPI). However, most of the implementations I have dealt with send and receive over two different lines and that tends to be the standard methodology.
What is the difference between QSPI and SPI on usage?
QSPI or Quad SPI actually does not adhere to the standard methodology and breaks the concept of sending and receiving at the same time. It utilizes four bi-directional I/O lines to send and receive data and is often used for memory applications (because it is faster than SPI). With QSPI you are not sending and receiving at the same time.
If I write a driver based on QSPI, will it work?
Certainly! You just have to familiarize yourself with the hardware that you are using. Again, SPI is very different from Quad SPI and you can often find hardware implementations that make it very easy to use QSPI. For example, your Zynq 7000 has a QSPI Controller that has a lot of features to simplify the coding process. It will also operate in a "legacy mode" that acts as a normal SPI controller. On top of that, the Zynq 7000 has two other standard SPI controllers that are not setup for QSPI. I would highly encourage you to read the technical documentation here:
http://www.xilinx.com/support/documentation/user_guides/ug585-Zynq-7000-TRM.pdf
If I write a driver from scratch, what is the basic procedure?
That is very hardware dependent. I did a quick overview of your hardware, but detailing the steps here would take far too long. However, the technical manual for your device appears to have great step-by-step instructions for configuring and using both the QSPI and SPI controllers. Here is an example from the SPI section:
17.3.1 Start-up Sequence
Example: Start-up Sequence
Reset controller: Assert and de-assert the Ref and CPU_1x resets, refer to section 17.4.1 Resets.
Program clocks: Program the SPI_Ref_Clk, refer to section 17.4.2 Clocks.
Tx/Rx signal routing: Refer to section 17.5 I/O Interfaces.
Controller configuration: Refer to section 17.3.2 Controller Configuration.
Interrupt configuration: Configure the ISR to handle the interrupt conditions. The simplest ISR
reads data from the RxFIFO and writes content to the TxFIFO. The PS interrupt controller is
described in Chapter 7, Interrupts. The interrupt mechanism for the SPI controller is described in
section 17.3.5 Interrupt Service Routine.
Start data transfers:
Master Mode operation select: Manual/Auto start and SS, refer to section 17.3.3 Master Mode Data Transfer.
Slave Mode operation, refer to section 17.3.4 Slave Mode Data Transfer.
I hope that helps!
I am using the ARM-based microcontroller LPC1769 and the LPCXpresso IDE. I am using an example project for Vcom using USB Device controller in 1769. By default it works at 9600 baud. But I don't understand how to change the baud rate - I want to use it at higher baud rate.
Please define every thing well for better answer, I am providing the computer side answer,
If you are connection with Computer, Its using generic Com port which will be assigned to the device,
now, again if you are using computer, the com port have configuration. go to device manager, and see properties>> Configuration>> there you will see baud rate.
go and change that,
that will do. :)
Edit: Updated with links of support in Driver Side,
I have few link for the same VCP(Virtual Comp Port) Drivers you can use
http://www.ftdichip.com/Drivers/VCP.htm
and Documentation for the same in different different case, please refer documentation first :)
http://www.ftdichip.com/Support/Documents/DataSheets.htm
this is all from my side :)