Another update: I tried to minimize the time the NRF is on, so the current consumption in run mode is now less than 8mA. This means that the nunchuk can be on for more than 120 hours on 2 AA batteries.
erwincoumans said:
vedder said:
* I have changed to this receiver on the VESC:
http://www.ebay.com/itm/NRF24L01-PA-LNA-SMA-Antenna-Wireless-Transceiver-communication-module-2-4G-1100m-/381268741220?pt=LH_DefaultDomain_0&hash=item58c5634c64
Yes, that is the extended range version that I am testing too (PA+LNA/SMA). I have not had glitches with the regular nRF24L01+, as long as the transceiver is not too close to the motor or controller. The PA+LNA antenna seems a bit bulky for a hand-held controller.
I'm only using the PA+LNA version on the receiver, the transmitter in the nunchuk is still the small smd module. So even if the TX power is the same, the gain in the antenna and possibly in the rx part of the LNA help a lot.
erwincoumans said:
I also have a USB dongle version of the nRF24L01+PA+LNA that works on Linux and Mac, so you can communicate to your VESC nRF24L01+. I use libusb to communicate with the USB transceiver. So you could use it also to wireless upload a new firmware and perhaps custom user-plugins for VESC. If you are interested in that, I can put the source code for this in a github repo.
Here is a link to the 'crazy radio long range': http://www.seeedstudio.com/depot/Crazyradio-PA-long-range-24Ghz-USB-radio-dongle-with-antenna-p-2104.html
It would be nice to have some code that uses libusb for that
erwincoumans said:
I still prefer the ease of programming using the Arduino IDE over programming the STM32Fx series, Arduino seems to have more tutorials and library coverage. So if you want to go for STM32Fx it would be helpful to provide some tutorial how to write 'plugins', and make it easy to upload those plugins over USB instead of firmware flasher.
It is most likely easier for beginners to get an LED blinking with Arduino, but the Arduino IDE is horrible. Eclipse with indexing, refactoring, auto-completion etc. is so much better. Also, I think the Arduino libraries are not made for making complex programs. When things grow, ChibiOS with threads and the libraries made for an rtos is so much better. Even with the nunchuk transmitter I think the code is easier to follow than it would be if it was written using arduino. Another reason I prefer chibios with STM is that I can use the same code base for the VESC and the nunchuk implementation, which makes development easier for me.
Regarding writing and uploading firmware to the stm32f100, I'm using the build in UART bootloader in the f100, which is very similar to how firmware is uploaded to the arduino. Even an arduino could be connected to my modified nunchuk to upload firmware if you really want to do that. Otherwise, a CP2012 or ftdi USB-toUART module such as this one works:
http://www.ebay.com/itm/Replace-FT232-6Pin-USB-2-0-to-TTL-UART-Module-Serial-Converter-CP2102-STC-/321546809495?pt=LH_DefaultDomain_0&hash=item4addaef097
A short tutorial for Ubuntu goes something like this:
1. Install toolchain
Code:
sudo apt-get remove binutils-arm-none-eabi gcc-arm-none-eabi
sudo add-apt-repository ppa:terry.guo/gcc-arm-embedded
sudo apt-get update
sudo apt-get install gcc-arm-none-eabi=4.9.3.2015q2-1trusty1 git build-essential
2. Install stm32flash
Code:
git clone https://github.com/ARMinARM/stm32flash.git stm32flash
cd stm32flash
make
sudo make install
3. Connect the USB-to-UART module to the nunchuk PCB:
DTR is connected to the reset pin
RTS is connected to the boot0 pin
RX and TX are connected as usual (RX to TX and TX to RX).
4. Get and upload the firmware:
Code:
git clone https://github.com/vedderb/nunchuk_mod.git nunchuk_mod
cd nunchuk_mod
make upload
5. Done! If you'd like, open main.c and study/modify it. Then upload it again with