• Resolved

PGA460-Q1: Interfaced to Arduino Uno_source code

Prodigy 50 points

Replies: 7

Views: 104

Part Number: PGA460-Q1

Hi,

    Could you please share me the arduino source code for interfacing the PGA460-Q1.I have designed and developed the ultrasonic sensor module using PGA460-Q1 driver IC and Murata sensor.I would like to inteface this sensor with arduino uno for getting the distance information.Please provide the suitable source code for this 

Thanks & regards

Sreejith S V

  • Hi Sreejith,

    For PGA460 software development, I recommend that you start with the PGA460 Software Development Guide and PGA460 Energia Library and Code Example downloads. These will help guide you with USART (UART and SPI) specific examples for the Energia and Arduino microcontroller kits.

    For information on the general structure of the USART packet, refer to section "7.3.6.2.1 USART Asynchronous Mode" of  the datasheet: http://www.ti.com/lit/ds/symlink/pga460-q1.pdf. Note the non-default 2-stop bit requirement for the UART configuration.

    Akeem Whitehead // Texas Instruments // ASC-SENSING-CSPS // Applications Engineer
    Visit our Ultrasonic Sensing FAQ page for additional information.
  • In reply to Akeem Whitehead:

    Thanks Akeem for your quick response.Will go through these documents and get back to you if any support is required for the same.

    Thanks & Regards

    Sreejith

  • In reply to Sreejith S V:

    I just gone through the document and tried to compile the code using arduino id,getting so many errors.I solved  most of the errors,but still there is some errors related to the library functions.Could you please share me the modified code which is suitable for arduino ide and arduino controller.My actual aim is to get the distance data from the sensor via one wire communication using arduino .Sensor board is ready with pga460 and murata sensor.

  • In reply to Akeem Whitehead:

    I just gone through the document and tried to compile the code using arduino id,getting so many errors.I solved  most of the errors,but still there is some errors related to the library functions.Could you please share me the modified code which is suitable for arduino ide and arduino controller.My actual aim is to get the distance data from the sensor via one wire communication using arduino .Sensor board is ready with pga460 and murata sensor.

  • In reply to Sreejith S V:

    Hi Sreejith,

    Does Arduino Uno support Serial1? The code uses two serial ports: one for serial communication to the PC, and the other for serial/UART communication to the PGA460.

    To get the PGA460 Energia library to run in Arduino Mega:

    1) Delete the following from the PGA460EnergiaLibrary_vx.x.x library folder: "PGA460_SPI.cpp", "PGA460_SPI.h", "utility" folder. The SPI functions for the PGA460 were customized specifically for the MSP430F5529 microcontroller. SPI support is only enabled through Energia, not Arduino at this time.

    2) Replace all instances of #include <Energia.h> to #include <Arduino.h> in the library files (PGA40_USSC.h/.cpp)

    3) In all files, change any reference of "PUSH2", "GREEN_LED", "RED_LED" to a Arduino pin numbers. These designators are specific to the Energia.h file for the LaunchPads.

    4) Delete case 3 from the initBoostXLPGA460 function in PGA460_USSC.cpp.

    Akeem Whitehead // Texas Instruments // ASC-SENSING-CSPS // Applications Engineer
    Visit our Ultrasonic Sensing FAQ page for additional information.
  • In reply to Akeem Whitehead:

    Hi Akeem,

                      Thanks for your reply.I already solved the issues by studying the code and modified for  Arduino IDE.Successfully compiled for Arduino Mega .My sensor PCB fabrication is in progress and after getting it assembled will test this code using arduino mega and sensor board.Will let you post the status.

    Can I interface multiple sensor using the same code and what will be the interface for multiple sensor interface?

    My assumption is by changing the address we can interface multiple sensors using one wire interface.For that I need to connect serial to onewire transceiver chip in between arduino serial and sensor board and connect all the sensor boards IO line to transceiver output?Is this correct,Please let me know

    Thanks

    Sreejith

  • In reply to Sreejith S V:

    Hi Sreejith,

    The PGA460 offers four different interfaces: UART, SPI, OWU, and TCI

    OWU and TCI are automotive interfaces referenced to high-level battery. In this case you would need a transceiver to level shift from VPWR (i.e. 12V) to 5V for a logic high.If your application is not automotive, I recommend that you use UART or SPI so you can directly interface the PGA460 to the Arduino without the need for a transceiver. UART/SPI is much easier to work with anyway.

    Because the PGA460 has a three-bit software address (UART_ADDR), you can have up to eight PGA460s on the same UART or SPI bus. Refer to PGA460 FAQ #4.4.11 (http://www.ti.com/lit/pdf/slaa733) for details on auto-addressing:

    4.4.11 Is daisy-chain supported by the PGA460? Can the master controller automatically differentiate and program the PGA460 UART address? Daisy-chain auto-addressing and automatic slave node position detection (SNPD) are not supported by the PGA460. External hardware or switches must be used in combination with the external master controller to automatically assign address to multiple PGA460 devices connected to the same bus. The example provided is interchangeable for the IO and TX pin. When switching IO, be sure select a bidirectional switch rated for VPWR (up to 30 V). The TX pin is a unidirectional pin rated at either 3.3V (default) or 5.0 V.

    Akeem Whitehead // Texas Instruments // ASC-SENSING-CSPS // Applications Engineer
    Visit our Ultrasonic Sensing FAQ page for additional information.