Pages: 1 ... 12 13 [14] 15 16 ... 31   Go Down
Author Topic: Cosa: An Object-Oriented Platform for Arduino programming  (Read 94291 times)
0 Members and 1 Guest are viewing this topic.
Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

To continue the presentation of the refactoring of the Cosa SPI class here are some further details. Below is a snippet from the new header file.

Code:
class SPI {
public:
  enum Clock {
    DIV4_CLOCK = 0x00,
    ...
    MASTER_CLOCK = 0x08,
    DEFAULT_CLOCK = DIV4_CLOCK
  } __attribute__((packed));

  enum Order {
    MSB_ORDER = 0,
    LSB_ORDER = 1,
    DEFAULT_ORDER = MSB_ORDER
  } __attribute__((packed));

  class Driver {
  protected:
    ...
  public:
    Driver(Board::DigitalPin cs,
    Clock clock = DEFAULT_CLOCK,
    uint8_t mode = 0,
    Order order = MSB_ORDER,
    Interrupt::Handler* irq = 0);
  };

public:
  SPI();
  bool begin(Driver* dev);
  bool end();
  uint8_t transfer(uint8_t data);
  void transfer(void* buffer, uint8_t count);
  ...
};

The most important addition to the previous SPI interface is that the SPI::Device class, which is the device driver support class, holds information about the device SPI hardware setting, chip select and possible interrupt handler (pin).

SPI::begin() and SPI::end() become essential functions that mark the beginning and end of an SPI transaction. They will handle 1) asserting the chip select pin, 2) disabling/enabling all interrupt sources on the SPI bus (if any) and most important 3) setting the SPI hardware state for each transaction. This allows several devices with different SPI settings to be integrated without conflicts.

Below is a snippet from the current implementation. NB: The macro synchronized marks a block of code as mutual exclusive (i.e. interrupt handing is turned off). The macro is part of the syntax abstraction in Cosa (See Cosa/Types.h).

Code:
bool
SPI::begin(Driver* dev)
{
  synchronized {
    ...
    m_dev = dev;

    // Initiate the SPI hardware with the device driver settings (context)
    SPCR = dev->m_spcr;
    SPSR = dev->m_spsr;

    // Select the device
    dev->m_cs.toggle();

    // Disable interrupts from SPI devices
    for (dev = spi.m_list; dev != 0; dev = dev->m_next)
      if (dev->m_irq) dev->m_irq->disable();
  }
  return (true);
}

bool
SPI::end()
{
  synchronized {
    ...

    // Deselect the device
    m_dev->m_cs.toggle();

    // Enable interrupts from SPI devices
    for (Driver* dev = spi.m_list; dev != 0; dev = dev->m_next)
      if (dev->m_irq != 0) dev->m_irq->enable();
   
    // Release the SPI driver support
    m_dev = 0;
  }
  return (true);
}

Below is a snippet from the ST7735 TFT device driver to gives an idea of typical usage of the SPI device driver support. NB: The asserted(pin) is a macro that will toggle the pin before and after the block. The chip select is handled by SPI::begin/end. Please also note that the internal/protected write methods are used within a transaction as set_port() and draw_pixel(). These two Canvas methods are given in full detail to give an idea how this works.

Code:
class ST7735 : public Canvas, SPI::Driver {
protected:
  OutputPin m_dc;
  enum Command {
    NOP = 0x0, // No Operation
    RDDID = 0x04, // Read Display ID
    RDDST = 0x09, // Read Display Status
    RDDPM = 0x0A, // Read Display Power Mode
    ...
  } __attribute__((packed));

  ...

  void write(Command cmd)
  {
    asserted(m_dc) {
      spi.transfer(cmd);
    }
  }

  void write(Command cmd, uint8_t data)
  {
    asserted(m_dc) {
      spi.transfer(cmd);
    }
    spi.transfer(data);
  }

  void write(Command cmd, uint16_t data)
  {
    asserted(m_dc) {
      spi.transfer(cmd);
    }
    spi.transfer(data >> 8);
    spi.transfer(data);
  }

  void write(Command cmd, uint16_t x, uint16_t y)
  {
    asserted(m_dc) {
      spi.transfer(cmd);
    }
    spi.transfer(x >> 8);
    spi.transfer(x);
    spi.transfer(y >> 8);
    spi.transfer(y);
  }

public:
  ST7735(Board::DigitalPin cs = Board::D10,
Board::DigitalPin dc = Board::D9);

  void set_port(uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1)
  {
    spi.begin(this);
    write(CASET, x0, x1);
    write(RASET, y0, y1);
    write(RAMWR);
    spi.end();
  }

  virtual void draw_pixel(uint8_t x, uint8_t y)
  {
    set_port(x, y, x + 1, y + 1);
    color16_t color = get_pen_color();
    spi.begin(this);
    spi.transfer(color.rgb >> 8);
    spi.transfer(color.rgb);
    spi.end();
  }

  ...
};

Cheers!
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi! Here is some news on the latest update and development of Cosa:

1. The SPI and TWI device driver support has been improved so that many of the problems described on this forum may be avoided when using multiple device driver libraries and interrupts. The Arduino SPI library does not allow several devices with different settings and is not interrupt safe. The Cosa SPI support will handle chip select (with pulse for HD44780 SR with SPI), interrupts from SPI sources, SPI hardware module context switch, etc.

2. The Cosa SPI and TWI device drivers have been updated to take advantage of the above improvements. This increases both robustness and code quality. Also with the new abstractions reduce the code volume/footprint. Please see changes to ST7735.

3. The Cosa LCD/HD44780 device driver for 4-bit parallel port has been updated to allow easier configuration.

Cheers!
« Last Edit: October 09, 2013, 04:03:55 am by kowalski » Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi! Here is some news on the latest update and development of Cosa:

1. TWI device driver for BMP085 digital pressure sensor.
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/TWI/Driver/BMP085.hh

2. SPI device driver with interrupt handler for CC1101 (433 MHz) Low-Power Sub-1 GHz RF Transceiver. Tested on Arduino Nano IO Shield with CC1101 module with pinout as the RF24L01+ module. Simple interrupt handler for incoming messages. Can be configured with TI SmartRF Studio. Default configuration as panstamp (but 433 MHz).
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Wireless/Driver/CC1101.hh
http://www.ti.com/tool/smartrftm-studio

3. Added support for even higher speed update of output pins. Unprotected (non synchronized) update member functions. Typically used when several updates are performed within a synchronized block.
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Pins.hh#L353

4. Adding datatype cast operator (e.g. operator uint8_t()) to bit-field definitions to reduce code complexity and improve readability.
https://github.com/mikaelpatel/Cosa/commit/93990e49de7725dc820bb6bc201051411aa12bba

5. New directory structure for drivers for Wireless devices.

Cheers!
« Last Edit: October 09, 2013, 04:02:42 am by kowalski » Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi! This week the Cosa project takes another jump forward. Below are some of the highlights.

1. The Cosa NRF24L01P and VWI (Virtual Wire Interface) device drivers have been adapted to the Cosa Wireless abstract class/interface. This allows VWI, CC1101 and NRF24L01P device drivers to be interchanged by simply altering a single line of code. See Wireless example sketches.
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Wireless.hh
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Wireless/Driver/NRF24L01P.hh
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Wireless/Driver/VWI.hh
Previous enhanced mode VWI Transceiver has be replaced by the new Wireless interface based version of VWI. The update of VWI adds node addressing but removes the retransmission functionality.

2. A Registry class has been added to allow mapping from path string (number sequence) to objects in memory. This will together with the Wireless interface allow simple implementation of panstamp/SWAP like protocols with great flexibility.
http://code.google.com/p/panstamp/wiki/SWAP
The Registry allows the following basic register/node types; ITEM with name string and type, ITEM_LIST for directory nodes in the register tree, ACTION object reference and BLOB for binary objects. The interface is very thin with only two primary functions (as the Registry is defined statically in program memory); lookup() to allow mapping from index sequence to Register and apply() to allow execution of an ACTION object. There is a macro set to support creating the data structure in program memory. No data memory is used for the Registry. It follows the same design pattern as the Cosa LCD Menu system.
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Registry.hh
https://github.com/mikaelpatel/Cosa/blob/master/examples/Sandbox/CosaRegistry/CosaRegistry.ino

3. The Cosa Pin classes benchmark now includes additional tests with the new unprotected OutputPin write/set/clear member functions. These allow an additional X2-X4 performance increase compared to the Arduino/Wiring digitalWrite function. The benchmark also show the mapping between Arduino/Wiring pin functions and Cosa.
https://github.com/mikaelpatel/Cosa/blob/master/examples/Benchmarks/CosaBenchmarkPins/CosaBenchmarkPins.ino

4. The LCD driver for 4b parallel port and soft SPI have been updated with the new unprotected/fast pin member functions and are now 10-20% faster. An outer synchronized block is used to protect updates to the ports/pins. The LCD adapter member function HD44780::SR3W::write4b(uint8_t data) is a good example of how a synchronized block may be used to protect a sequence of updates.
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/LCD/Driver/HD44780_IO_SR3W.cpp#L35

5. A simple touch capacitive sensor has been added. See example sketches for further details.
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Touch.hh

See the Issues log on github for more details on what is going on.
https://github.com/mikaelpatel/Cosa/issues?state=open

Cheers!

« Last Edit: October 14, 2013, 02:44:15 pm by kowalski » Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi! The focus these last weeks in the Cosa project has been low power mode and additional example sketches for the Wireless interface and device drivers (CC1101, NRF24L01+ and RF433 modules).

1. Low Power Mode
Out of the box Cosa will turn off analog converter and comparator until needed or explicitly powered up. There are two new member function for AnalogPin; powerup() and powerdown(). The Analog Comparator is powered up resp down on enable() and disable() of the interrupt handler.

2. Wireless Interface
There are a number of new sketches to show how to use the Wireless interface and device drivers. These also show how to swap device with only minor changes to the sketch. There is a general sender and receiver sketch, a simple message stream debugger, an example sketch that samples a DHT11 and broadcasts the temperature and humidity reading, and also a sketch to demonstrate low power mode.

3. Low Power Wireless on ATtiny85
To verify the low power handling for ATtiny an additional example Wireless sketch has been added. This sketch will power down and wait for a button to be pressed. During the wait only a minimum of the internal hardware modules are used. When the button is pressed the internal hardware is enabled and a message with a timestamp and three analog readings is send. After the transmission is completed the device goes back into power down mode. This allows the power down current to be a low as 5 uA for an ATtiny85-20PU with the Watchdog enabled.
https://github.com/mikaelpatel/Cosa/blob/master/examples/Wireless/CosaWirelessButton/CosaWirelessButton.ino

4. Registry
The Registry handler has been improved and will now allow mapping from the directory to data stored in SRAM, PROGMEM and EEMEM. There is also a full example sketch to show how application data can be stored in the directory.
https://github.com/mikaelpatel/Cosa/blob/master/examples/Sandbox/CosaRegistry/CosaRegistry.ino

The Registry and the Wireless interface will become the basis for a small scale variant of SMNP and have many features in common with panstamp/SWAP.

Cheers!
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Please find Cosa on Ohloh! https://www.ohloh.net/p/cosa
You can register your usage of Cosa and get a lot of information about the project.

Cheers!
« Last Edit: October 23, 2013, 01:53:20 pm by kowalski » Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey kowalski.  Great to see you are still plugging away at this project!!

I just purchased the same CC1101 modules as you (http://www.ebay.com/itm/2pcs-CC1101-433MHz-Wireless-Transceiver-Module-NRF905SI4432-with-SMA-Interface-/221274129252) and am wondering if they are usable with the AtTiny85 chips?  Seeing "#if !defined(__ARDUINO_TINYX5__)" at the top of the CC1101.hh/cpp files leads me to believe they might not be?

If they are compatible, what pins get connected between the CC1101 modules at the Tiny85?

Thanks in advance for any assistance!!
« Last Edit: November 01, 2013, 09:13:43 am by sirhax » Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi sirhax!

Yes the project is still going strong and there is a lot more that I would like to add and achieve. The CC1101 module you have found is exactly what I am using in my prototyping. It works fine as a replacement for the NRF24L01+ module on for instance the Arduino Nano IO Shield.

Right now I have removed the usage of ATtiny85 as the pin D2 is both the USI/SPI clock (SCK) and external interrupt (EXT0). This is possible to solve by using a Pin Change Interrupt (PCI-pin) or simply removing the interrupt handler for ATtiny85. Need to push this onto the backlog (issue list) and figure out a priority for this update. Actually the same goes for NRF24L01+.

You might want to have a look at the ongoing work on the protocol; Cosa Rete. This will become Cosa's version of the panstamp SWAP protocol and work on all Cosa Wireless drivers (RF433, CC1101 and NRF24L01+), and support low power nodes out of the box. Cosa Rete is a scaled down version of SNMP with a dash of DDS (OMG Data Distribution Service). Cosa Wireless interface is one of the building blocks. The other building block is Cosa Registry which acts as a MIB with mapping to application data. The vision is a framework for very easy implementation of low power wireless sensor/actuator nodes.

Cheers!

Ref:
1. https://github.com/mikaelpatel/Cosa/blob/master/RETE.txt
2. https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Rete.hh
3. https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Wireless.hh
4. https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/Registry.hh
5. https://github.com/mikaelpatel/Cosa/blob/master/examples/Sandbox/CosaRegistry/CosaRegistry.ino
6. http://en.wikipedia.org/wiki/Simple_Network_Management_Protocol
7. http://en.wikipedia.org/wiki/Management_information_base
8. http://en.wikipedia.org/wiki/Data_Distribution_Service
« Last Edit: November 01, 2013, 08:18:28 am by kowalski » Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the reply, kowalski!

That makes sense.  For now I just ordered a handful of "ATTINY84A-PU-ND"s from digikey.

That's certainly some very cool and interesting work!  I'm anxious to see it in its final form  smiley.

Along the lines of "internet-of-things", have you seen this project?
http://www.kickstarter.com/projects/flutterwireless/flutter-20-wireless-arduino-with-half-mile-1km-ran
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Along the lines of "internet-of-things", have you seen this project?
http://www.kickstarter.com/projects/flutterwireless/flutter-20-wireless-arduino-with-half-mile-1km-ran
Thanks for the feedback and the kickstarter link. That was an interesting project. I have seen a number of Arduino-clones with varying functions on kickstarter. Would be nice to see a project or two with software as the main focus instead of just hardware. Will soon need to produce a board and/or shields to fund further development of Cosa ;-)

Cheers!
Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Some news on the latest developments in Cosa. The theme has been supporting multi-DOF boards and improving TWI sensor drivers.

1. New TWI driver for L3G4200D Digital Gryposcope.
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/TWI/Driver/L3G4200D.hh

2. New TWI driver for MPU6050 Motion Processing Unit; Digital thermometer, accelerometer and gyroscope.
https://github.com/mikaelpatel/Cosa/blob/master/cores/cosa/Cosa/TWI/Driver/MPU6050.hh

3. Major refactoring and improvement of the TWI drivers for BMP085 and ADXL345.

4. Improved TWI scanner. Will print name and short description of connected devices. Verifies identity register (WHO_AM_I) if available. See CosaTWIscanner. https://github.com/mikaelpatel/Cosa/blob/master/examples/TWI/CosaTWIscanner/CosaTWIscanner.ino
Code:
device = 0x1e:group = 3.6:HMC5883L, 3-Axis Digital Compass
device = 0x53:group = 10.3:ADXL345, Digital Accelermeter
device = 0x69:group = 13.1:L3G4200D, 3-Axis Digital Gyroscope
device = 0x77:group = 14.7:BMP085, Digital Pressure Sensor
Above is the scanner information generated for the GY-80.

6. Extended example sketch for GY-80 10DOF module.
Code:
Cosa10DOF: started
free_memory() = 1499
sizeof(TWI::Driver) = 3
sizeof(ADXL345) = 3
sizeof(BMP085) = 37
sizeof(HMC5883L) = 13
sizeof(L3G4200D) = 3
acceleratometer.begin() = 1
bmp.begin(BMP085::ULTRA_LOW_POWER) = 1
gyroscope.begin() = 1
compass.begin() = 1
ADXL345(x = 260, y = 2, z = 2)
BMP085(temperature = 222, pressure = 98462)
HMC5883L(x = -579, y = 36, z = -143)
L3G4200D(x = -43, y = 216, z = 3)

ADXL345(x = 258, y = 0, z = 0)
BMP085(temperature = 222, pressure = 98459)
HMC5883L(x = -579, y = 18, z = -143)
L3G4200D(x = -53, y = 204, z = 15)

ADXL345(x = 260, y = 0, z = 0)
BMP085(temperature = 221, pressure = 98451)
HMC5883L(x = -579, y = -4, z = -143)
L3G4200D(x = -9, y = 197, z = -4)
https://github.com/mikaelpatel/Cosa/blob/master/examples/TWI/Cosa10DOF/Cosa10DOF.ino

6. Wireless IOStream class. Use any Wireless driver as an IOStream. The below example sketch will send digital and analog pin readings over the connected wireless driver and display on an LCD (monitor).
https://github.com/mikaelpatel/Cosa/blob/master/examples/Wireless/CosaWirelessIOStream/CosaWirelessIOStream.ino
https://github.com/mikaelpatel/Cosa/blob/master/examples/Wireless/CosaWirelessMonitor/CosaWirelessMonitor.ino
Cheers!
« Last Edit: November 07, 2013, 02:46:14 pm by kowalski » Logged

Rapa Nui
Offline Offline
Edison Member
*
Karma: 60
Posts: 2086
Pukao hats cleaning services
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A note to the BMP085 driver: you may add the barometric pressure reading, as the pressure you measure now is the "absolute pressure". Thus, if you want to see the barometric pressure your local weather station reports (ie. a local airport) you have to calculate "Barometric pressure adjusted to Sea Level" (as this is how they report it).
You have to provide your Altitude (in meters over the sea level) as well.
For example:

Code:
 /**
   * Return latest calculated Absolute pressure from temperature and pressure
   * raw sensor data.
   * @return calculated pressure in steps of 1 Pa (0,01 hPa).
   */
  int32_t get_ABS_pressure()
  {
    return (m_pressure);
  }
    
   /**
   * Return latest calculated Barometric pressure from Absolute pressure
   * and your altitude over Sea Level.
   * You have to provide your Altitude [meters] over the sea level.
   * @return calculated pressure in steps of 1 Pa (0,01 hPa).
   */
  int32_t get_BSL_pressure(int32_t myAltitude, int32_t ABSpressure) {
  float p;
  p = ABSpressure / pow((1.0 - ( myAltitude / 44330.0 )), 5.255);
  return (int32_t) p;
  }

Code:
 // Calculate and print values
  trace << PSTR("BMP085(mode = ") << mode
<< PSTR(", temperature = ") << bmp.get_temperature()
<< PSTR(", ABS pressure = ") << bmp.get_ABS_pressure()
<< PSTR(", BSL pressure = ") << bmp.get_BSL_pressure(235, bmp.get_ABS_pressure())
<< PSTR(", delay = ") << (stop - start)
<< PSTR(")") << endl;

Code:
BMP085(mode = 1, temperature = 238, ABS pressure = 97811, BSL pressure = 100581, delay = 32)

PS: to avoid a "chicken-egg" situation, you may get your Altitude by changing the altitude in above function until the BSL reading is equal to the number your local weather station reports (most current report, as the pressure changes with time and location).
« Last Edit: November 10, 2013, 01:40:01 pm by pito » Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@pito

Thanks for your suggestions. I guess this formular could also be transformed and used to calculate for instance height using relative change in pressure. From a design perspective I want to isolate these types of calculation from the sensor drivers and provide them in a separate class/library.

This week the focus has been on improving the support for low-power mode and pushing the default idle mode as low as possible. I have added a number of example sketches to show how to go towards ultra low power (1-10 uA range) in power-down.

Below is a link to one of the sketches. It is a basic wireless temperature sensor using DS18B20s and Cosa Wireless interface and drivers (NRF24L01P, CC1101 or RF 433). The sketch will power up and issue a conversion request to two DS18B20 sensors. Sleep until the conversion to complete (750 ms). After that the temperature samples are read and sent in a message together with a sequence number and the power supply status (i.e. battery voltage). The results for an Arduino Mini Pro 16 Mhz with Power LED removed with the VWI driver and a RF 433 module are;
Code:
Power       Idle    Sampling  Transmitting        
LiPo 3.9 V  40 uA   1.3 mA    6 mA
FTDI 5,1 V  190 uA  1.5 mA    10 mA
https://github.com/mikaelpatel/Cosa/blob/master/examples/Wireless/CosaWirelessDS18B20/CosaWirelessDS18B20.ino
Further reduction is possible by removing the regulator from the Arduino Mini Pro and running on the internal 8 MHz clock. On an Arduino LilyPad the power down mode is less than 1 uA.

Cheers!
« Last Edit: November 11, 2013, 05:08:05 am by kowalski » Logged

Offline Offline
Newbie
*
Karma: 2
Posts: 19
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey Kowalski,
I'm having trouble getting the CC1101 transceivers to work, and am hoping that you can offer some assistance smiley.  Here's my setup:

I have an UNO R3 running CosaWirelessReceiver and a Mega2560 running CosaWirelessSender.

I commented out the two NRF24 lines and uncommented the CC1101 lines in both programs as follows:
Code:
#include "Cosa/Wireless/Driver/CC1101.hh"
CC1101 rf(0xC05A, 0x01);

// #include "Cosa/Wireless/Driver/NRF24L01P.hh"
// NRF24L01P rf(0xC05A, 0x01);

Here is how I have the boards/chips wired up:
Code:
CC1101   UnoPin# MegaPin#
1:GND    GND     GND
2:3.3v   3.3v    3.3v
3:CE     9       48
4:CSN    10      53
5:SCK    13      52
6:MOSI   11      51
7:MISO   12      50
8:IRQ    2/EXT0  21/EXT0
I did happen to notice one discrepancy between the NRF24 and CC1101 code in that the NRF24 uses EXT4 on the Mega while CC1101 uses EXT0.

The programs upload and start fine, I just don't see any "traffic".

I'm using the transceivers right out of the box, assuming that the Cosa driver applies necessary any configuration parameters, correct?  Can you offer any advice on debugging this issue?


Thanks!
« Last Edit: November 11, 2013, 02:46:09 pm by sirhax » Logged

Sweden
Offline Offline
Sr. Member
****
Karma: 11
Posts: 473
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@sirhax

Actually your setup looks fine. The default settings for NRF and CC use IRQ from D2 which is EXT0 for Uno and EXT4 for Mega. I use a Nano IO Shield and a Mega Prototype Shield. Both with NRF 2X5 connector to SPI, etc.

I rigged up a Mega running CosaWirelessSender and a Nano running CosaWirelessReceiver to verify. There are a fair amount of configuration ;-). Anyway it works as it should; both ways.

After the latest improvements for low power mode I needed to adjust  CC1101::await() to get the correct wait behaviour between transmitted messages.  The broadcast message in CosaWirelessSender could go missing.

Try the default setting with IRQ connected to D2.

Cheers!
Logged

Pages: 1 ... 12 13 [14] 15 16 ... 31   Go Up
Jump to: