I am trying to use press buttons via I2C using nRF52832 Sparkfun breakout board. I followed the steps given in nrf52832-breakout-board-hookup-guide and changed the I2C Data and CLK pins to 24 and 25, respectively. I connected these pins and GND of the board to the corresponding pins and scanned for I2C devices. But it gave error = 2 (no I2C device) for all addresses. Should I use pull-up resistors? I would appreciate any help.
Yes pull-up resistors on both SCL and SDA MUST be provided for I2C communication. Please see the following links:-
Infocenter specification (See very end of section)
Devzone Question 1
DevZone Question 2
DevZone Question 3
I also recommend asking similar questions on Electrical Engineering or directly on the Nordic DevZone as there is higher chance of this being answered quicker.
I hope this helps
Thanks for your reply. I think it depends on the I2C device that we are using. This module has internal pull-up resistors, but it may not be enough for some devices. So, I disabled the internal pull-ups by replacing GPIO_PIN_CNF_PULL_Pullup with GPIO_PIN_CNF_PULL_Disabled for both SDA and SCL pins in the library and used external ones.
Related
I have question, because I have problem with connection Atmega8 with mpu6050 by means of I2C.
This is my connection:
Is this a good connetion?
Connections look good.
MPU6050 module has on board 3.3v regulator.
The module has also on board pull up resistors for I2C communication. So simply we can connect it directly without any extra components.
You can find this document useful: http://www.electronicwings.com/avr-atmega/mpu6050-gyroscope-accelerometer-temperature-interface-with-atmega16
answer will depend of the board used. MPU6050 is basically a 3.3V chip (not 5V). But if the daughter board is well designed (and boards designed to work for Arduino are) the connection seems to be OK.
Some more information may be accessible here : enter link description here
I'm currently trying to burn the pinguino bootloader in a pic32mx250f128b which is 5V tolerant with an arduino uno. I'd want to try pic32 chips, but I haven't a pickit3 now, I can only access to pickit2.
So to burn the bootloader I'm using an arduino uno, and use the bitbang sketch from pic32prog to try to burn it.
For the wiring I did this :
All VDD and the VUSB3V3BUS pins are wired to the 3V3 regulator of the arduino uno.
All VSS pins are connected to the ground of the arduino uno.
Arduino D2 (PGC) is directly connected to PGEC1
Arduino D3 (PGD) is directly connected to PGED1
Arduino D4 (MCLR) is directly connected to MCLR
But actually, when I launch pic32prog I always have this output :
Programmer for Microchip PIC32 microcontrollers, Version 2.0.218
Copyright: (C) 2011-2015 Serge Vakulenko
(ascii ICSP coded by Robert Rozee)
Adapter: ... OK1 OK2 - ascii ICSP v1E
No target found.
I tried also with the couples PGEC2/PGED2 and PGEC3/PGED3.
I haven't tried to use a crystal yet, but I think from what I read it's not needed for ICSP programming.
For now here is what I've done on my breadboard :
photo of the pic on the breadboard
I don't know what could cause this detection problem,
Thank you very much for your help :)
Edit : I tried several things and here is where I am :
I added the pull-up on MCLR, capacitors on VDD pins, and others recommended : Still the error No target found.
I saw that pic32prog add compatibility with pickit2 so I tried it : this time the pic is detected but I get this error : Unknown CPUID : ffffffff. I tried also with a new pic32mx250 on the pickit2 to be sure it wasn't the first which was damaged.
Finally to recheck my connections I found another version of the datasheet. In this one it seems that PGECx and PGEDx pins aren't 5V compatible... -> So I'll test with 3.3v compatible circuit this time
you need 3k3 pullups to the 3v3 supply rail on both PGC and PGD. these two outputs are 'open collector' (simulated) and the 3k3 resistors define the logic '1' voltage fed to the PGC and PGD pins of the target PIC32.
as mentioned by others, you also need a 10k pullup on MCLR. in addition, you need to ensure that all Vcc pins (13 and 28) are connected together, all ground pins (8, 19 and 27) are connected together, and that there is a 10uF low ESR ceramic capacitor from pin 20 to ground (a 22uF tantalum will do).
see the "ascii ICSP construction guide" article here:
http://www.thebackshed.com/docregister/Browse.asp
the article includes a schematic of what is required.
cheers,
rob :-)
the 10uF low ESR ceramic capacitor on pin 20 is crucial. pin 20 connects ONLY to this capacitor, nothing else. without it, the core of the PIC32 will not run and programming will be impossible.
the reason for this is that the core of the PIC32 runs at 1.8 volts, and the capacitor on pin 20 is part of the circuitry that generates this supply. in your photo it looks like pin 20 is not connected to anything.
cheers,
rob :-)
I found that pin 10 and pin 11 often used in the software-serial library in Arduino or having priority to it?
is there any Memory peripheral bus is attached to it?
I think the point is that the SoftwareSerial library requires change interrupts. Since Arduino Mega, Mega 2560, Leonardo as well as Micro supports change interrupts on the pins 10,11, it is maybe a good decision to write examples based on these pins and avoid further problems of pin capabilities with different Arduino boards...
I am recently connecting a gyroscope(L3G4200D) to ATTINY84,however, the gyroscope is using I2C and the ATTINY84 is using USI, as a result, I have some problem doing programming. I am using Arduino Uno to be the ISP, and I have connected the two wire of gyroscope to SDA and SCL pin on Attiny84 but it still doesn't work. Does anyone have any solution?
This might help you solve your problem!
http://www.dexterindustries.com/howto/working-with-avr/any-port-any-pin-a-twi-master-for-attiny-atmega/
Solution is in using right library which do software I2C. get https://github.com/svoisen/TinyWire library, connect 4 wires ( VCC, GND, SDA, SCL ), do not forget 2 pull-up 4K7 resistors to SDA/SCL. that's all.
Can SPI hardware on the Arduino Nano be used?
On the Nano page it says:
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI
communication, which, although provided by the underlying hardware, is
not currently included in the Arduino language.
Yet there is an SPI library.
Please can someone explain this contradiction? I think, either
The nano page is out of date
SPI library is unsupported for the Nano SPI hardware but is supported on other boards
SPI library is implemented for the Nano in software only
Which is it?
Thanks
The correct answer is "some combination of the above":
Arduino Nano is based on the ATmega168/328 chip, which does support SPI in hardware.
The SPI library only supports hardware SPI (regardless of the Arduino model). Note that you could bitbang (relatively) slow SPI without any problems, this would be a relatively easy software implementation.
The status of SPI library should be considered same as the status of the Wire library: not part of core Arduino services (in contrast to PWM, ADC, and digital GPIO), but widely supported nonetheless.
So perhaps the closest answer in your multiple-choice question is "out of date". The status of SPI should look the same as the status of I2C.
This should be a comment but I haven't the rep.
As angelatlarge said, the SPI library is as supported for the Nano as it is for any of the other Arduinos. Except:
The Nano (like all Arduinos) has an LED attached to digital pin 13. Since, for the Nano, pin 13 is also SCLK for SPI, you may well run into trouble with high baud rates. If this is a problem for you, try removing the LED.
From the Nano's page: Source
...
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication, which, although provided by the underlying hardware, is not currently included in the Arduino language.
LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the LED is on, when the pin is LOW, it's off.
The Nano's product page is out of date, but it has the same hardware and software SPI support as the other ATmega168/ATmega328p-based Arduinos.
Some archaeology in the wayback machine reveals that the functionally comparable Duemilanove's product page was changed from a hardware-but-not-software mention to a mention of SPI library support between September 15th and 26th of 2010. When the Uno came out, its product page was based on the then-current state of the Duemilanvoe's, so it has always claimed support.
A corresponding update should have been made to the Nano page, but this appears to have been overlooked.