Hi Gilles, I can give it a try this weekend. I do not have a 18f45k22 but I may have a 18f25k22 (same family).
One more question. This device operates at 3.3 Volt and in your schematic diagram you connect it to VCC and directly to the PIC but for that your PIC needs to work at 3.3. Volt too. If the PIC is operating at 5 Volt you need to have level shifters between the PIC and the nRF905. Also see the blog post: JAL Library for the nRF905 transceiver module | Just Another JAL Website (justanotherlanguage.org)<http://justanotherlanguage.org/node/322> I hope VCC is not +5Volt. If so then you may have damaged the device. Let me know if this is the case or not. I will let you know as soon as I have tested it with your program. Kind regards, Rob ________________________________ Van: [email protected] <[email protected]> namens [email protected] <[email protected]> Verzonden: dinsdag 9 februari 2021 09:07 Aan: jallib <[email protected]> Onderwerp: Re: [jallib] [jallib/jallib] 1dd7c1: Added new JAL library for the nRF905 Hi Rob, thank you for your quick answer Yes you're right, I made a mistake while posting (I was a bit tired ;-) , the correct code I tested with is this one: -- nRF905 pin definition. alias nrf905_spi_sck is pin_B3 alias nrf905_spi_sck_direction is pin_B3_direction -- To SCK of nRF905 alias nrf905_spi_sdi is pin_B1 alias nrf905_spi_sdi_direction is pin_B1_direction -- To MISO of nRF905 alias nrf905_spi_sdo is pin_B2 alias nrf905_spi_sdo_direction is pin_B2_direction -- To MOSI of nRFF905 alias nrf905_csn_pin is pin_A1 alias nrf905_csn_pin_direction is pin_A1_direction -- To csn of nRF905 alias nrf905_txen_pin is pin_B5 alias nrf905_txen_pin_direction is pin_B5_direction -- To txen of nRF905 alias nrf905_trx_ce_pin is pin_B4 alias nrf905_trx_ce_pin_direction is pin_B4_direction -- To (tx_)ce of nRF905 the rest of the program remains unchanged. As you can see, it seems that the module always "sees" something to receive... Also some parameters appear to be incorrect, but I don't know what to change. Maybe there is something specific to add for the 18F45K22 ? Regards, Gilles Le lundi 8 février 2021 à 18:56:47 UTC+1, [email protected] a écrit : Hi Gilles, Sorry to hear that. I had a quick look at you schematic diagram but there is something that I do not understand. You have made connections to the module using port B but the interface pins in your software for the communication are all on port C (and one on A). I am talking about these pin assignments in your program -- nRF905 pin definition. alias nrf905_spi_sck is pin_C0 -- Pin 10 for 14 pin DIP alias nrf905_spi_sck_direction is pin_C0_direction -- To SCK of nRF905 alias nrf905_spi_sdi is pin_C1 -- Pin 9 for 14 pin DIP. alias nrf905_spi_sdi_direction is pin_C1_direction -- To MISO of nRF905 alias nrf905_spi_sdo is pin_C2 -- Pin 8 for 14 pin DIP. alias nrf905_spi_sdo_direction is pin_C2_direction -- To MOSI of nRFF905 alias nrf905_csn_pin is pin_C3 -- Pin 7 for 14 pin DIP. alias nrf905_csn_pin_direction is pin_C3_direction -- To csn of nRF905 alias nrf905_txen_pin is pin_A5 -- Pin 2 for 14 pin DIP. alias nrf905_txen_pin_direction is pin_A5_direction -- To txen of nRF905 alias nrf905_trx_ce_pin is pin_A4 -- Pin 3 for 14 pin DIP. alias nrf905_trx_ce_pin_direction is pin_A4_direction -- To (tx_)ce of nRF905 These aliases are still from the sample program. You have to change these aliases so that they match with your hardware schematig. Or am I missing something here? Kind regards, Rob ________________________________ Van: [email protected] <[email protected]> namens [email protected] <[email protected]> Verzonden: maandag 8 februari 2021 14:50 Aan: jallib <[email protected]> Onderwerp: Re: [jallib] [jallib/jallib] 1dd7c1: Added new JAL library for the nRF905 Hello Rob A bit late :-( but I never could make this library work for me. Here is my code, which is a simple copy of your sample, whithout the use of interruptions. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% -- % % -- % Test Module nRF905 % -- % % -- % Langage JALV2 % -- % GBA 01/2021 % -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% include 18f45k22 -- target PICmicro -- -- This program assumes that a 20 MHz resonator or crystal -- is connected to pins OSC1 and OSC2. pragma target clock 20_000_000 -- oscillator frequency -- pragma target OSC HSH -- crystal or resonator pragma target PLLEN DISABLED -- PLL off pragma target WDT DISABLED -- watchdog pragma target XINST DISABLED -- do not use extended instructionset pragma target DEBUG DISABLED -- no debugging pragma target BROWNOUT DISABLED -- no brownout reset pragma target FCMEN DISABLED -- no clock monitoring pragma target IESO DISABLED -- no int/ext osc switching pragma target LVP ENABLED -- low voltage programming pragma target MCLR INTERNAL -- no external reset -- -- The configuration bit settings above are only a selection, sufficient -- for this program. Other programs may need more or different settings. -- OSCCON_SCS = 0 -- select primary oscillator OSCTUNE_PLLEN = FALSE -- no PLL include delay include print -- formatted output library -- Active les résistances pull-up du port B INTCON2_NRBPU = 0 -- Désactive les convertisseurs A/D enable_digital_io() -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% -- % Traitement du port RS232 -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% -- -- Définition des valeurs du port série const USART_HW_Serial = TRUE -- TRUE = RS232, FALSE = SPI const Serial_HW_Baudrate = 9600 pin_c5_direction = output pin_c6_direction = output pin_c7_direction = input include Serial_Hardware Serial_HW_Init pin_c5 = HIGH -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% -- % FIN Traitement du port RS232 -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% enable_digital_io() -- Take some time to stabilize. _usec_delay(100_000) -- For debugging purposes this constant can be defined. const NRF905_DEBUG = TRUE -- nRF905 pin definition. alias nrf905_spi_sck is pin_C0 -- Pin 10 for 14 pin DIP alias nrf905_spi_sck_direction is pin_C0_direction -- To SCK of nRF905 alias nrf905_spi_sdi is pin_C1 -- Pin 9 for 14 pin DIP. alias nrf905_spi_sdi_direction is pin_C1_direction -- To MISO of nRF905 alias nrf905_spi_sdo is pin_C2 -- Pin 8 for 14 pin DIP. alias nrf905_spi_sdo_direction is pin_C2_direction -- To MOSI of nRFF905 alias nrf905_csn_pin is pin_C3 -- Pin 7 for 14 pin DIP. alias nrf905_csn_pin_direction is pin_C3_direction -- To csn of nRF905 alias nrf905_txen_pin is pin_A5 -- Pin 2 for 14 pin DIP. alias nrf905_txen_pin_direction is pin_A5_direction -- To txen of nRF905 alias nrf905_trx_ce_pin is pin_A4 -- Pin 3 for 14 pin DIP. alias nrf905_trx_ce_pin_direction is pin_A4_direction -- To (tx_)ce of nRF905 -- We use software SPI. If not defined, hardware SPI is used. const bit NRF905_SOFTWARE_SPI = TRUE -- When using the power pin, define it here. If not used connect the power pin -- of the module to VCC. -- const NRF905_USE_PWR_PIN = TRUE if defined(NRF905_USE_PWR_PIN) then alias nrf905_pwr_up_pin is pin_A1 -- Pin 12 for 14 pin DIP. alias nrf905_pwr_up_pin_direction is pin_A1_direction end if -- This program uses the interrupt way of receiving new data which gives the -- main program more time before processing it. But since the main program does -- not do very much this feature is not really needed here. --const NRF905_USE_INTERRUPT = TRUE if defined(NRF905_USE_INTERRUPT) then alias nrf905_dr_pin is pin_A2 -- Pin 11 for 14 pin DIP, external interrupt. alias nrf905_dr_pin_direction is pin_A2_direction -- To DR of nRF905 alias nrf905_external_interrupt_enable is INTCON_INTE alias nrf905_global_interrupt_enable is INTCON_GIE alias nrf905_external_interrupt_edge is OPTION_REG_INTEDG alias nrf905_external_interrupt_flag is INTCON_INTF alias nrf905_postive_interrupt_edge is TRUE end if -- nRF905 addresses. We use 4-bit addresses (default). const dword NRF905_RX_ADDR_1 = 0x11223344 -- My address. const dword NRF905_TX_ADDR_1 = 0x55667788 -- Address of device 1. const dword NRF905_TX_ADDR_2 = 0xBBCCDDEE -- Address of device 1. -- We do not use the library default payload size (default is maximum of 32). const byte NRF905_TX_PAYLOAD_SIZE = 25 const byte NRF905_RX_PAYLOAD_SIZE = 25 -- The RX buffer size must be equal to or bigger than the highest payload size. const byte NRF905_RX_BUFFER_SIZE = 25 include nrf905 -- Some text constants. const byte start[] = "Test program for nRF905.\r\n" const byte hello_1[] = "Hello World 1!" const byte hello_2[] = "Hello World 2!" -- Used variables. var word timer var byte counter, index, pipe var byte device_to_send_to var bit sending_data -- Initialize the bRF905 module with the default values. nrf905_init() -- Set receiver address of this device. nrf905_set_rx_address(NRF905_RX_ADDR_1) -- Our module has a 16 MHz clock (init value is 20 MHz) nrf905_set_crystal_clock(NRF905_CRYSTAL_CLK_16MHZ) -- Set a different payload width for this program. nrf905_set_rx_payload_width(NRF905_RX_PAYLOAD_SIZE) nrf905_set_tx_payload_width(NRF905_TX_PAYLOAD_SIZE) -- A little bit more power please. nrf905_set_power_level(NRF905_POWER_LEVEL_MAX) -- Show welcome message on the screen. print_string(serial_hw_data,start) print_crlf(serial_hw_data) timer = 0 sending_data = FALSE device_to_send_to = 1 nrf905_print_configuration_register() forever loop -- Loop timer 1 ms. _usec_delay(1_000) -- Send a message to one of the devices and alternate devices.. timer = timer + 1 -- Wait 1 second before sending the next message. if (timer >= 1_000) then print_crlf(serial_hw_data) if (device_to_send_to == 1) then -- Send to first device. print_string(serial_hw_data,"Sending data to device 1 ... ") nrf905_set_tx_address(NRF905_TX_ADDR_1) nrf905_send_data(hello_1, count(hello_1)) device_to_send_to = 2 elsif (device_to_send_to == 2) then -- Send to second device. print_string(serial_hw_data,"Sending data to device 2 ... ") nrf905_set_tx_address(NRF905_TX_ADDR_2) nrf905_send_data(hello_2, count(hello_2)) device_to_send_to = 1 end if sending_data = TRUE timer = 0 end if -- Print the transmission status and enable the receiver. if sending_data & nrf905_tx_ready() then -- Transmission done, check if successful. print_string(serial_hw_data,"Transmission Done! \r\n") print_string(serial_hw_data,"Enabling receiver ... \r\n") -- Enable receiver again. nrf905_power_up_rx() sending_data = FALSE end if -- Print the message from any of the 2 devices. Ignore the values 0x00 which -- can be added when the received message is shorter than the maximum payload. if nrf905_get_data() then print_crlf(serial_hw_data) print_string(serial_hw_data,"Receiving data: ") for NRF905_RX_PAYLOAD_SIZE using index loop if nrf905_rx_buffer[index] != 0x00 then serial_hw_data = nrf905_rx_buffer[index] end if end loop print_crlf(serial_hw_data) end if end loop The way it is connected to my pic: [Capture.JPG] And finally what it outputs: [Capture2.JPG] The library "nfR905.jal" is unchanged, I just added the status return which is always 255 Why is frequency illegal? I tried many many ways to make it run, but I'm a bit lost, since I don't undertand why it works for you... I need a help !!! Regards, Gilles Le dimanche 26 juillet 2020 à 17:30:02 UTC+2, [email protected] a écrit : Hi Gilles, You're welcome. Let me know if you run into any issues using this library. Kind regards, Rob ________________________________ Van: [email protected] <[email protected]> namens Gilles BARTHELEMY <[email protected]> Verzonden: zondag 26 juli 2020 15:18 Aan: [email protected] <[email protected]> Onderwerp: Re: [jallib] [jallib/jallib] 1dd7c1: Added new JAL library for the nRF905 Thank you Rob !! Le dim. 26 juil. 2020 à 15:02, Rob Jansen <[email protected]> a écrit : Branch: refs/heads/master Home: https://github.com/jallib/jallib Commit: 1dd7c1bb5e824c27ec6928b1c4d4d98c192cde86 https://github.com/jallib/jallib/commit/1dd7c1bb5e824c27ec6928b1c4d4d98c192cde86 Author: Rob Jansen <[email protected]> Date: 2020-07-26 (Sun, 26 Jul 2020) Changed paths: M CHANGELOG M TORELEASE R include/external/nrf24l01/nrf24l01.jal R include/external/virtual_wire/virtual_wire.jal R include/external/virtual_wire/virtual_wire_receiver.jal R include/external/virtual_wire/virtual_wire_transmitter.jal A include/external/wireless/nrf24l01.jal A include/external/wireless/nrf905.jal A include/external/wireless/virtual_wire.jal A include/external/wireless/virtual_wire_receiver.jal A include/external/wireless/virtual_wire_transmitter.jal A sample/16f1823_nrf905.jal A sample/16f1825_nrf905.jal Log Message: ----------- Added new JAL library for the nRF905 Also moved all wireless libraries to a common wireless library on Github. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/jallib/jallib/push/refs/heads/master/7db43a-1dd7c1%40github.com. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/CACRWQHcbSFdTMk18BqOthygL3M4xYuyZVv9-O_F6LCOBFOyExA%40mail.gmail.com<https://groups.google.com/d/msgid/jallib/CACRWQHcbSFdTMk18BqOthygL3M4xYuyZVv9-O_F6LCOBFOyExA%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/c5468e47-6b02-4e21-8177-4b4e77e0666cn%40googlegroups.com<https://groups.google.com/d/msgid/jallib/c5468e47-6b02-4e21-8177-4b4e77e0666cn%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/b25014e5-d76d-4369-9d58-c6e41373d0e7n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/b25014e5-d76d-4369-9d58-c6e41373d0e7n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/AM0PR07MB6241E57C777595971AA6C0F1E68E9%40AM0PR07MB6241.eurprd07.prod.outlook.com.
