Arduino - Sparkfun USB host - arduino

I am building a device and need to use a USB Nordic ID rfid reader. I have a Spark-fun USB host card (V9947), and now need the firmware to allow be bi directional chat in a 'rs232' style serial... just as if it were a hardware or software serial port on the Arduino.
Nordic support have reassured me that their library and examples for the Arduino are normally used with readers with RS232 ports, however the same code will work with their smaller USB device if I can overcome the USB/serial barrier.
I have the library and examples for the USB host board, but cannot determine which example code resembles my requirement requirement, I have looked through the library and found no answer there either.
This could be down to personal stupidity/ignorance... however never been this stumped before. the internet does not seem to have an answer, documentation and support for this board are at best meager.
I hope someone here has managed to solve what should be a simple mission, and I can get on with this project.
Thanks Ian

As not knowing what you already have done, I'll make a walk through the complete setup. Please check(do) each point evenif you think its done already:
Soldering and hardware have no shorts
pin headers of the shield are soldered with no shorts
USB Jack of Arduino is isolated on the top to prevent shorts
With the SparkFun board, it seems like you MUST supply external power on Vin or the barrel jack. 5V from the USB cable will not work reliable.
You must also run a jumper from pin D7 to RESET.
For the board (SparkFun DEV-09947) set up – these are mandatory pre-requirements.Now the software
The code/drivers you need to use for this board are on this GitHub page.
There is a diagnostic test which is extremely useful for checking wether your board is working correctly. Do as follows:
Upload this sketch to your Arduino, then open the Serial Monitor to see the diagnostic info.
To see the output set your Serial Monitor terminal speed to 115200
Plug in your hardware into the USB of the shield
Reset the Arduino to start the diagnostic
Step 1 – you’ll see it recognize the board and start a transfer test
Step 2 – you’ll see it attempt to test the GPIO pins – you’ll get “GPIO test failed” message. Type something in the box at the top of the Serial Monitor, then hit “Send” button and the diagnostic test will continue.
Step 3 – you should see it cycle through a bunch of resets, then it will attempt to detect an USB device – as we have a device plugged into the USB port on the shield you should then see some summary info with a final message of “All tests passed”
So NOW we know the hardware is working and basic software is running.
Next step driver installation/test program for the Nordic
Get the library from here
Import NurMicroApi_arduino.zip to IDE. From menu: Sketch->Include library->Add .ZIP library...
Open example. From menu: File->Examples->NurMicroApi->NurExample
Change baudrates and sw serial pins to match your arduino HW In this example NUR module is connected to arduino via software serial pin 10 (RX) and pin 11 (TX) with baudrate 38400. HW serial is used as print output.
You may have to change this to the USB card connections (see diag-SW)
As an easier option you can use the HID parser to check if your NUR is recognized If that works take a working exmple like:
Working HID example and try to read a tag then start coding with the NUR example from above if values are not correct interpreted
If you want to use the "pure" at-Terminal (RS-232) style you have to get rid of the usb shields functions (lib) and write your own Arduino firmware based (=overcome the USB/serial barrier) on the nordic-api (well documented) Hope this gets you started

Related

Atmel ICE C initial connection problems

I have ATMEL ICE C initial connection problems - it cannot read device signature, because of the target board voltage isn't between range of 1.8 to 5.5V. It has measured by the Atmel Studio as 1.3V (when target board is powered by the USB connector) or 0.3V (when USB disconnected from target).
It'a a brand new device, and i never used it before, may be i did something wrong?
I had used before AVR ISP handmade by myself, and had used previously programmed target board for this experiment, to avoid possibility, that board is dead. The target is works and blinking heart beat.
What i has done -
1.Connect the target board to the ICE programmer.
2.power target board by USB.
3.power programmer by USB from PC USB port.
4.open "device programming" tab in AS 7.
5.Make all settings for my chip atmega328p
6.press "apply" then 'read'
7.get err msg that voltage is too low.
(while i had measured it directly, by the digital voltmeter on pins +5V and GND on target
board, it's about 4.5V, same as in ISP connector - measured on 2 and
6 pins.)
=======================================================
#markus-nm where did you take your measurements?
i had measured on pin 2 and 6 of ISP connector and between pin +5V and GND on Arduino Nano board.
What reference was used?
i had used GND pin on target board for the reference.
Did you use the same USB Host for ISP and power?
no, power to target board was from the wall socket USB charger, AND power to Atmel ICE is from personal computer.
If not, did you connect the grounds?
no, but i guess that grounds are already connected on the target board.
Some links to your chip, your board and ISP would be helpful.
ATMEL-ICE-C https://www.microchip.com/en-us/development-tool/ATATMEL-ICE
ARDUINO NANO PRO https://store.arduino.cc/products/arduino-nano
If it's a custom PCB, provide some schematics. Show a wiring diagram of what you did.
no, i had used the standard Nano board (may be not original, but clone, but it is definitely working now, because it can be programmed by the AVRDUDE program and work.)
The Atmel-ICE, by design, has a lot of different ways to hook up the programming connector. Often when I see problems like this it's because the wrong connector is used. Keep in mind the programmer itself has both an AVR and a SAM port. For the Arduino Nano Pro, make sure it's plugged into the AVR port. After that, ensure you're using the correct programming connector on the adapter board that comes with the Atmel-ICE and that it's oriented correctly on the Nano's header.
If that all fails then something is broken.

Microchip Studio / STK500 Got 0xc0, expected 0x00

This project started as a typical hobbyist (me) learning how to replicate an Arduino Uno's basic functionality on a breadboard using an ATMEGA328P-PU. The basic intent of the circuit is to trigger 8 otherwise independent Halloween props using a single input, either cycling them continuously or upon command based on an input from a PIR sensor.
After validating the effectiveness of my design on a breadboard I had SMT PCBs professionally made which use ATMEGA328P-AUs (the SMT equivalent).The complete PCB schematic is provided below.
My PCB manufacturer informed me that they received an error when trying to upload my hex file using their STK500 connected to my on board ICSP header. Subsequently, they shipped my prototype PCBs with bare ATMEGA328P-AUs.
Upon receiving the PCBs I was able to use an Arduino Uno as ISP connected to my PCB's on board ICSP header to successfully load the Arduino bootloader, then successfully upload my Arduino program. I have repeated this process successfully multiple times and have subsequently been able to validate that the PCB logic behaves as intended in my application. My pin out on my PCBs ICSP header is identical to the ICSP header on an Arduino. It is 8 pins because I added TX and RX at the top.
I installed Microchip Studio and connected an STK500 via COM1. In Device Programming I selected device ATMEGA328P and Interface ISP. When I click "Read" I get the error depicted below. When I connect an Arduino Uno everything reads fine which leads me to believe that while my circuit contains the components required for a breadboard Arduino it is missing something that the STK500 needs to recognize it as a device.
After searching these forums and Google for similar problems the only two solutions that I can find are to use the internal clock (presumably on the ATMEGA328P?) and to "Disable Debugwire and Close" in Microchip Studio. All of the Debug functionality in Microchip Studio is greyed out for me and it isn't clear to me how I can change clock settings on a device that I can't communicate with. I did specifically incorporate an external clock to improve timing accuracy in my application, though, if that matters.
Any help or insight would be greatly appreciated.

Is it possible to factory reset an arduino from hardware to remove bad user code?

I was troubleshooting why Serial1 was always throwing undefined errors in sketches I was trying to run when I found a solution posted online for a slightly different board that suggested this line:
HardwareSerial Serial1(2);
I uploaded it and now the Arduino doesn't show up in the IDE, did I remap it's serial communications? Why is this possible!
Is there any hardware factory reset option available on these boards? Did I just brick my device?
edit: It seems the STM32Cube programmer app can be used to communicate with the device but I'm not sure where to get the original firmware to flash. https://imgur.com/a/LbiHenf
Assuming from the tag in your question, I guess you have an STM32 – (BluePill) Development Board (STM32F103C8).
If you think that your board is not handling serial communication properly then you might consider burning bootloader to your board. This will reset the complete configuration of your board.
There are many ways in which you can burn bootloader to your board.
Using another Arduino board like Uno / Nano / Mega
Using an FTDI USB to TTL Serial Adapter.
You might want to go through tutorials list below:
Getting Started with STM32 using Arduino IDE: Blinking LED
Programming STM32F103C8 Board using USB Port

PWM/PPM Output misses some edges

I am using ESP8266 (NODEMCU 3.0 or something) to make a quadcopter. Ive connected ardu pro mini to RC receiver so I am reading PPM values from it. Pro mini sends data with tx to ESP8266. ESP reads it with software serial with 115200 baudrate. I am communicating with MPU9255 (Waveshire) via I2C either.
My problem is that I cant fully controll my brushless motors. When I was using arduino instead of ESP8266, servo library was the best and reliable. But ESP's servo library is different, since its not AVR, and problems occurs. First of the servo library didnt want to work on most frequencies. I mean default is 50Hz (20000uS) and in this state ESC of motors did armed but unfortunatelly when changes was fast and short (1250-> 1370 -> 1250) it did miss that change like nothing happnd... This makes my D value in PID controller useless...
Sometimes on 100Hz freq all was working fine, but sometimes not...
When Ive started to use analogWrite only 500Hz was working fine, rest of freq didnt want to arm ESCs.
PS. I am using 3.3V to 5V converter for PPM/PWM pins so I am sure that the signal is fine for ESCs.
PS2. I dont have any osciloscope unfortunately.
The ESP82266 present on your module is a RF transceiver integrated circuit that can handle WiFi communication, both configured as a slave to a microcontroller such as the ones present on various Arduino boards, or as a standalone chip by having it's on-board Tensilica L106 32-bit processor programmed via an external SPI flash memory. If used as a slave, the communication between, for example, an Arduino an the ESP82266 can be done using different protocols such as SPI / SDIO or I2C / UART interfaces. Googling a comprehensive Tensilica L106 user guide on the internet doesn't seem an easy task, and it looks as if some people have already failed to find it. If you're seeking to add Wi-Fi capabilities to your quadcopter the solution I suggest is having the Arduino take control over the servos, motors, etc. and hand off messages via SPI to your ESP82266 module. If this isn't the answer you are looking for, please try to be clearer about it, maybe find someone to do as an English translator for you.
However, if this is what you're concerned about, and you would like to use the ESP82266 module as as standalone solution, please link its built-in processor datasheet and the relevant parts of the quadcopters code that might need debugging.

Arduino controlled robot : without uploading every time

I've recently built an Arduino-controlled robot(4WD platform) using a beginner's kit.
After uploading compiled program into Arduino, I was able to get 4WD motors working.
But when I disconnect the USB cable after successful "uploading" and I turn on the mobile platform switch, it doesn't move a bit.
What procedure is required for getting it to move (I mean.. having machine language permanently stored in AVR microcontroller's memory) without again connecting USB cable to Arduino and uploading program after I find the code working so that just turning on the switch of the robot make it start to move as programmed?
It REALLY sounds like a power issue.
-What is powering your arduino when the USB is disconnected?
The USB from a computer is often pretty strong (hight current) and a 9V battery might not cut it for electric motors and such.
If this is the problem you may want to try a more powerfull battery setup, like 4 AAs.
You may go the LiPo battery route from a source like Adafruit or Sparkfun. Then the problem is that a LiPo battery only produces 3.3V. Ugh, you'll need an circuit to bump the voltage to 5 (which Adafruit sells) and a charger. This may be your best choice if you're planning to use the robot a lot.

Resources