dsPIC33FJ256MC710 Troubleshooting and Solutions

Publisher:平和思绪Latest update time:2009-09-08 Source: 单片机与嵌入式系统Keywords:dsPIC33FJ256MC710 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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.

Hardware interface block diagram

According to Microchip's application note, the QEI initialization procedure is as follows:

program

When running the program in debug mode, an oscilloscope can be used to observe that the level on the chip's 53rd pin RF 8 flips every time the encoder position crosses zero. The QEI module works normally. After downloading the program in program mode, an oscilloscope can be used to observe that the level on the chip's 53rd pin RF8 does not change every time the encoder position crosses zero, and the QEI module does not work properly.

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:

program

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:

program

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.

Voltage waveform of RD15 pin output

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:

program

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.

Keywords:dsPIC33FJ256MC710 Reference address:dsPIC33FJ256MC710 Troubleshooting and Solutions

Previous article:Application of microprocessor dsPIC33F in microcomputer protection device
Next article:A new algorithm for interference signal detection, tracking and positioning system

Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号