This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Can I use nRF24L01+ with pic? is there any library?

Hi there. We are developing an IoT device (we are planning to use nRF24L01+) we would like to implement with microchip uC, the question is if there is a library available for CCS or MPIDE, or any other C compiler. If not I will writing it... The big question is, how big would the library be to fit in the pic memory, in order to avoid purchasing the expensive ones, so we can keep the budget low. I suppose somebody went through this already , and I would like to know what problems faced.. anyway. I want to know more about the product than reading the specs. thanks a lot in advance

  • Hi

    We do not have any libraries that are directly usable with PIC uC's, but we have a nrf_hal library which is included in the nRFgo SDK: ..\Nordic Semiconductor\nRFgo SDK 2.3.0.10040\source_code\hal\nrf24l01p ..\Nordic Semiconductor\nRFgo SDK 2.3.0.10040\source_code\hal\nrf24le1

    The files you are interested in are: hal_nrf.c hal_nrf.h hal_nrf_reg.h

    Files that needs porting: hal_nrf_hw.c hal_nrf_hw.h

    Notes on hal_nrf.c: Functions "hal_nrf_read_multibyte_reg" and "hal_nrf_write_multibyte_reg" must be modified as they include 8051 memory type pointers.

    
      if (memtype == 0x00U)
      {
        const uint8_t data *buf = (const uint8_t data *)pbuf;
        NRF_WRITE_MULTIBYTE_REG_COMMON_BODY
      }
      else if (memtype == 0x01U)
      {
        const uint8_t xdata *buf = (const uint8_t xdata *)pbuf;
        NRF_WRITE_MULTIBYTE_REG_COMMON_BODY
      }
      else if (memtype == 0xFEU)
      {
        const uint8_t pdata *buf = (const uint8_t pdata *)pbuf;
        NRF_WRITE_MULTIBYTE_REG_COMMON_BODY
      }
      else
      {
        const uint8_t *buf = (const uint8_t *)pbuf;
        NRF_WRITE_MULTIBYTE_REG_COMMON_BODY
      }
    
    
      
    if (memtype == 0x00U)
      {
        uint8_t data *buf = (uint8_t data *)pbuf;
        NRF_READ_MULTIBYTE_REG_COMMON_BODY
      }
      else if (memtype == 0x01U)
      {
        uint8_t xdata *buf = (uint8_t xdata *)pbuf;
        NRF_READ_MULTIBYTE_REG_COMMON_BODY
      }
      else if (memtype == 0xFEU)
      {
        uint8_t pdata *buf = (uint8_t pdata *)pbuf;
        NRF_READ_MULTIBYTE_REG_COMMON_BODY
      }
      else
      {
        uint8_t *buf = (uint8_t *)pbuf;
        NRF_READ_MULTIBYTE_REG_COMMON_BODY
      }
    

    Basically, you want the last "else" to be executed.

    When these files are copied/ported you should also be able to run projects like "enhanched_shockburst" with some porting.

    This SDK can be found here: www.nordicsemi.com/.../nRFgo-SDK

    Best regards Håkon

Related