I've worked my way through the manuals and the forum posts, but I'm still unclear about my options for the following project:
I need a small device to control a single (RC) servo in response to commands issued from another microcontroller (in this case a dsPIC.) The dsPic master would issue commands telling the slave to move the servo to a stated position and hold there or sweep back and forth at a stated rate (and arc.) The project will initially require two of these slaved controllers (approximately 2-4 meters apart) and add more later (one servo per controller.) The length of the cable run from the master to the slaves won't exceed 10 meters.
I ordered and am waiting for 2 Nano 8's and Nano 8 pin Microcontroller Boards. I was attracted by the low cost and potentially low parts count of this approach.
Based on the data sheet, it appears that Hardware PWM is available on the Nano 8 (though this isn't reflected in the 'HPWM Capable Pins' table in the reference manual.) The reference manual states that HSERVO is not supported for the Nano, but it should be reasonable to code the problem using PWM.
My real challenge is how to network the Nano 8's. My three candidates appeared to be:
- I2C
- SPI
- Traditional Serial (e.g. RS232)
Initially, I imagined using the Nano 8 as an I2C slave, but this does not appear to be straightforward, even if it is an option (I read this post
http://forums.basicmicro.net/atomnano-f485/i2c-slave-mode-on-nano-t9463.html but was unable to build the .bas file.)
SPI is noted in the reference manual as stating "SHIFTIN and SHIFTOUT only work as a master device..." This appears to be a deal-killer for using SPI.
I could up the parts count and add a MAX232 to each of the Nano 8's and use Software Serial. However, I'm fuzzy on a few points relating to this approach:
- No UART on the Nano 8 seems to preclude using HSERIN.
- The data sheet refers to Software Serial and references the AUSART. I'm not clear on the use of the AUSART, any pointers to relevant docs would be useful.
- Does the single SER pin, as multiplexed to the TXD/RXD RS232 lines in the programming configuration, work with a traditional Serial (2-pin) model?
- Is the SER pin available as one of two pins for a two-pin approach? Does it have to be one or the other?
In any event, I'd be grateful for any observations, suggestions or help regarding the use of the Nano 8 for this project.