I2C communication Receiving NAK bit - microcontroller

I've SAME51N19 controller, I'm using sercom 1 for I2C communication from PIN A16=PAD0 SDA & A17=PAD1 SCL.
SAME51N19 facing Issues while transferring the data on address 0b0101001=0x29. Also, checking on oscilloscope not getting good. Attaching the oscilloscope image. I'm using I2C on standard mode. As master generates the clock and slave use the same, I think we don't need to set clock as slave or in slave controller. DefaultSharedI2CClockFrequency = 400000; Please help me to solve the issue.
Checked the connections SDA-SDA & SCL-SCL

Solved the issue by correcting the Transfer functions in code. It was just coding error. Thank you.

Related

how to communicate between openmote and arduino?

I'am working on an IOT project. The goal is to communicate between two openmotes (one is the server and one is the client). When the client receives some data, it is supposed to pass it to an arduino to activate different controllers (like a motor, some leds ...). So, I wanna send data from a openmote to an arduino. The idea is to use a bus. The openmote is the master and the arduino is the slave. Do you have any idea how to do this ? I can't find any documentation fro the open mote part. I thought about using the serial UART but i don't have any idea how to do that.
Thank you !
If anyone is looking for an answer, it is possible to activate the UART 1 on the open mote and to send data to the arduino using that bus. You have to pay attention to the speed you are using on both sides.You can refer to this file to see the functions to use: https://github.com/contiki-os/contiki/blob/master/examples/cc2538-common/test-uart.c

Arduino & ESP8266 - strange characters in response

I'm working on an Arduino Uno + ESP8266 project.
I try to use them as a web server on Wi-Fi network to control a motor that connects to Arduino - basically a trigger system that receives signals via Wi-Fi. Currently, I've successfully connected ESP8266 to my access point by sending AT commands from Arduino. Another client on the same network can statically access ESP8266's assigned IP address.
However, when I try to catch some HTTP queries (I want to use them as conditions to control the motor) I occasionally encountered the non-ASCII characters in HTTP request. I use serial comm to debug, please look at the screenshot in the link below:
Arduino - Computer serial communication for debugging
The line ",519:POST ..." should contain a complete number following "/?", but there's some strange characters instead. So I cannot determine the input data to control motor. Once in a blue moon, the expected format of request shows up as follows:
The correct data received
There's no issue with the HTTP response part, even though I got the uninterpretable request, I can still send the JSON error message back to client.
Attempt Note:
The Arduino uses different serial ports to talk to computer and ESP8266. Since the connection can be established, and the data being sent, I believe that the baud rate is simply correct on both side. (115200 for ESP8266, 9600 for computer - also tried 115200 for both and got the same result)
I use V3.3 from Arduino as power source for ESP8266. But I also use voltage regulator to smooth out the current as many people suggest that. The problem still remains.
I'm struggled with this issue for a few days, just want to know if anybody had the similar experience, or could give some clue for the next step.
After a considerable effort to stabilize the circuit, I switched to NodeMCU and got the system working perfectly. I assume that ESP8266 alone is somehow not robust enough without other components, which I unfortunately have no knowledge on.
So I'd like to close this thread with a short recommendation for anybody struggling with the same issue to switch to NodeMCU (which would replace both Arduino and ESP8266); if that could support the requirement.

Arduino Standalone

I have an Arduino Uno and I am using arduino 1.0.5 IDE. I followed he procedures for bootloading an atmega328P-PU on a breadboard.
I uploaded the ArduinoISP sketch first, made the connections(using the External Oscillator) and then wired it up. Then, I selected the programmer as Arduino as ISP, selected the board as Arduino duemilanove w/ Atmega328P. Then I selected the correct serial port and clicked Burn Bootloader.
I got the following errors:
avrdude.exe: stk500_program_enable(): protocol error, expect=0x14,
resp=0x50avrdude.exe: initialization failed, rc=-1 Double
check connections and try again, or use -F to override
this check.avrdude.exe: stk500_disable(): protocol error, expect=0x14,
resp=0x51
How to solve this issue? Also, can I upload the bootloader directly by using it on the Uno in place of the original chip. If so, how?
to my understanding the error you have indicates a bad reading from the chip. I experienced that with chips that were either dead or not properly connected, especially to power supply.
You may find more detailed information in th tutorial : https://www.arduino.cc/en/Tutorial/ArduinoISP
Especially those things :
Note for Arduino 1.0: you need to make one small change to the
ArduinoISP code. Find the line in the heartbeat() function that says
"delay(40);" and change it to "delay(20);".
Select the items in the
Tools > Board and Serial Port menus that correspond to the board you
are using as the programmer (not the board being programmed).
Instead of arduino built-in boot loader just go through below link and it will be great for uploading boot loader and verifying board status info
I am replying you this because same issue I got long back and it saved me.
One more thing for arduino boot loader: for atmega328 you need to put capacitor between reset and gnd( in case you missed)
For gammon bootloader you don't need it.
Be Innovative.
For reset line you might me using 100nf(thats what stated in documentation )...but sometimes it doesn't work...try something like 4.7uf, 22uf or 47uf or close values
I had a similar problem and the issue was that my programmer was a bit slow, I used the -B flag for avrdude to slow down the bitrate and it started working, I set the -B20 and works like a charm every time, but I use the USBTinyISP programmer, not the stk500 one, so this might not work for you.
In case someone stuck at this as I did and nothing like changing the cap value helped. Make sure you are using your USB-TTL adapter in a 5v mode (obviously for a 5v powered chip). I always used it in a 3.3v mode in order not to accidentally burn my 3.3v chips and it always worked. Until today, I was trying to flash my custom atmega8 board and everything worked with the ISP but I was having a hard time using the bootloader and after half a day searching and trying different stuff the 5v setting to the rescue.

Arduino Yun WifiStatus Example Failing

I am able to connect and upload the WifiStatus example per the instructions on the Arduino Site/Examples/Yun. However, when I hit the serial monitor button it is supposed to print out the relevant Wifi stats, instead it says "unable to connect" and the final line goes a bit further..."unable to connect: is the sketch using the bridge". Any ideas? A post suggested reseting the 32U4, which I did, but no luck.
Incidently, all of this is over Wifi. Board and port are set per instructions. Yun pings fine and receives the uploaded sketch fine.
More code is usually more illuminating... so you might get better answers when you provide more information.
"is the sketch using the bridge" seems to indicate that there is some problem with the Bridge library. Is it being initialized? Did initialization (i.e., "Bridge.begin()" succeed?
A sketch with bridge functional and serial monitor via network connection cannot be running simultaneously as they use the same hardware connection.
You may use the serial monitor via USB port, or Serial TX/RX pins, or SoftwareSerial for this.

What is the cause of "stk500_getsync(): not in sync: resp=0x00" in Arduino

I was using Arduino Uno to build a robot, but suddenly this error (stk500_getsync(): not in sync: resp=0x00) occurred. I tried a lot, searched on the net, to fix this error, but no solution worked for me. At last I bough 2 new Arduinos. But each of those 2 Arduinos ran few days correctly and after a few days gave the same error.
I was, and am, unable to find what causes this error. Can anyone kindly tell what could be the mistake I may be doing?
This has happened when the COM port is not correctly selected. Determine the COM port used to communicate with Arduino and set in in the IDE, then recompile the sketch.
I just found the reason from this link
of this error.
There are a TON of pages out there on how to solve this error. The problem is none of them worked for me. The typical solutions range from not having the correct serial port or correct Arduino model board selected under the Tools menu in the Arduino software, to not having a driver (or the correct driver) loaded.
However, the frustating part for me is I KNEW I had the correct serial port and board and driver selected because I was getting output from a sketch scrolling in the Serial Monitor window via a USB connection.
The fix? DISCONNECT ANY WIRES going to pin 0 (RX) while you do the upload. The sketch upload function uses the RX pin.
NOTE: You also need to disconnect any wires going to pin 0 (RX) if you have a sketch with a Serial.read() or Serial.peek() statement, and you want to use the Serial Monitor input field (as shown using the '752' in the example below) to feed data into the running sketch. If you don't disconnect pin 0 it will appear as if your data was entered into your sketch but nothing will happen because the data never truly gets input.
It's looks like there is no connection between PC and Arduino. Possible reasons: Something wrong with USB port OR driver, USB wire, ATMega16 controller, ATMega328 UART or bootloader. First, try to check, if data from Serial Port reaches Arduino. Pull ATMEGA from socket, short-circuit pins RX and TX on Arduino board (pins 0 and 1), and send some data from PC. You should receive exactly same string, as you sent. Also you should se RX TX LED's blinking. If you can't see data back, check if serial port you are using are actually exist in device manager, try to play with it's settings (speed, port numer), try to use another USB port and cable, etc.
I was having the same issue. But for me no led was lighting up on connection and the error observed was the same as yours. I fixed this by changing jumper pin configuration from ext to usb . You can try the same settings by altering the jumper pins between power jack and usb jack.

Resources