introduction
The dsPIC33FJ256MC710 high-performance 16-bit digital signal controller launched by Microchip Technology Inc., USA, adopts an improved Harvard architecture, an instruction set optimized by a C compiler, and a pipeline instruction fetching method. It has the characteristics of being practical, low-priced, having a small instruction set, low power consumption, high speed, small size, strong functions, and strong anti-interference ability. The dsPIC33FJ256MC710 high-performance 16-bit digital signal controller contains powerful control functions such as a 12-bit A/D converter (500 ksps), direct memory access (DMA), comparison output, capture input, I2C interface, SPI interface, CAN interface, USART interface, and Flash program memory self-reading and writing. The core also has powerful digital signal processing capabilities, and has broad application prospects, mainly used in motor control and other fields.
We encountered some unexpected problems in the actual application of the chip, some of which were caused by hardware design, some by external interference, and some by software initialization. The solutions to these problems were not provided in Microchip's application documents. We spent a lot of time analyzing and testing, and finally solved the problems. This article introduces these solutions to everyone to avoid spending too much time on this problem or causing losses due to some unsolvable problems.
1. Problems with the Quadrature Encoder Interface Module
The quadrature encoder interface module (hereinafter referred to as QEI module) of dsPIC33FJ256MC710 can work normally in debug mode and can get the rotation signal of the photoelectric encoder, but it does not work after program download and cannot get the rotation signal of the photoelectric encoder. This problem is somewhat hidden and difficult to find. We have never encountered it in the past when using Microchip chips.
The photoelectric encoder selected in this article has 1024 lines and differential signal output. This output method has high anti-interference ability when used in industrial sites, and the wires that can be connected are longer. Since the output of the photoelectric encoder is a differential signal, and the chip interface requires a TTL level signal, an AM26LS32 is added to complete the level conversion and convert the differential signal into a TTL level signal. The three groups of differential signals A and/A, B and/B, z and/Z output by the photoelectric encoder are connected to the AM26LS32 chip, converted into three TTL level signals A, B, and Z, and connected to the quadrature encoder interface module (QEI) of the dsPIC33FJ256MC710. A and B are orthogonal encoding signals, and z is the zero position signal of the photoelectric encoder.
The dsPIC33FJ series chip has an intelligent QEI module. It consists of three input channels: QEA, QEB and INDX. The two channels QEA and QEB have intelligent orthogonal decoding functions. The A and B two-phase orthogonal encoding signals output by the photoelectric encoder are connected to these two channels. The chip automatically determines the rotation direction and relative position of the photoelectric encoder through the decoding algorithm. The INDX channel is called the index pulse. By connecting the Z signal, the channel can determine the absolute position of the photoelectric encoder according to the absolute zero position and relative position. The hardware interface principle block diagram is shown in Figure 1.
According to Microchip's application note, the QEI initialization procedure is as follows:
When running the program in debug mode, an oscilloscope can be used to observe that the level on the chip's 53rd pin
Modify the initialization program and add the configuration of the analog-to-digital conversion module AD2PCFGL when initializing the multiplexed pins to solve this problem. The program is modified as follows:
When the modified program is in download (Program) mode, an oscilloscope can be used to observe that the level on the chip's 53rd pin RF8 flips every time the encoder position crosses zero, and the QEI module works normally.
When the QEI module is actually used, the absolute position of the measured rotating shaft can be known by directly reading the value of the POSCNT register. This article uses a 1024-line photoelectric encoder, selects the X4 mode by configuring the register, and the counting range of the POSCNT register is 0 to 4 096. According to the index pulse interrupt and the value of the POSCNT register, the rotation direction, rotation speed, current rotation shaft position, etc. of the rotating shaft can be accurately known, and the accuracy can reach 1/4 096.
2 Problems with RD15 as I/O output
The general I/O port is the most basic and commonly used interface. Microcontrollers and digital signal processors use it to implement the most basic high and low level logic control. When applied, when the 48th pin of the dsPIC33FJ256MC710 is used as an I/O output, it corresponds to RD15. When RD15 is used as a switch output, the software is set to a high level, but a high level cannot be established on the pin. Through a large number of tests and inspections, it was found that the 48th pin RD15 of the chip does not work properly when used as an I/O port. In order to illustrate the problem more clearly, the 47th, 53rd, and 54th pins RD14, RF7, and RF8 are introduced for comparison with RD15. The relevant verification procedures are as follows:
Run the above program and use an oscilloscope to observe that the levels on the 47th, 53rd, and 54th pins corresponding to the RD14, RF7, and RF8 of the dsPIC33FJ256MC710 chip are all regular square wave signals, while the high level on the 48th pin RD15 cannot be established normally, with only a very small spike pulse. The waveform is shown in Figure 2.
The upper waveform in Figure 2 is the level signal on pin 47 corresponding to RD14 for comparison, and the lower waveform is the level signal on pin 48 corresponding to RD15. The control method of the lower waveform is the same as that of the upper waveform (see the above program), but a high level signal cannot be obtained.
The method to modify the program is to add a no-operation instruction asm ("nop") after changing the register PORTDbits.RD15. The modified program is as follows:
After running the modified program, a regular square wave signal also appears on the 48th pin corresponding to RD15, solving the above problem. This problem is not easy to find in the application. There is no relevant explanation in the application notes of Microchip, so I wrote it in detail to give readers feedback.
Conclusion
This article introduces the internal resources of Microchip's high-performance 16-bit digital signal controller dsPIC33FJ series chips, and two difficult problems encountered when using the dsPIC33FJ256MC710 chip. These problems may be caused by hardware design, external interference or software initialization, and are often unexpected problems. This article uses relevant programs and waveforms to specifically explain the phenomena and solutions of these two problems, and attaches the corresponding programs, hoping to be helpful to readers.
Previous article:Application of microprocessor dsPIC33F in microcomputer protection device
Next article:A new algorithm for interference signal detection, tracking and positioning system
- Popular Resources
- Popular amplifiers
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- How do you spend the May Day holiday?
- [Chuanglong Technology Allwinner A40i Development Board] Qt performance test
- Antai Instruments Repair Sharing - Tektronix Oscilloscope Repair DPO5054B
- You can't change actors in a serialized TV series, otherwise it will become a different movie.
- The transformer in the power supply has no output after loading
- Compile imx6-ek200 with buildroot
- Using MSP430 to implement PWM signal
- Get the MPM54304 evaluation board for the first quad-output module with digital power management
- Dead time problem of IGBT drive waveform
- The difference between single-phase carrier and type 2 collector