Thread: [Flashforth-devel] flashforth on p18f4550 - No usb?
Brought to you by:
oh2aun
From: Scott B. <sba...@al...> - 2011-10-13 18:03:37
|
Hello! I'm trying to get flashforth going on a p18f4550. I've bought an experimenter board from Olimex: http://www.olimex.com/dev/pic-usb-4550.html I've git-cloned the latest flashforth, and installed the MPLAB tools that came with my PICKIT2 burner. I create a new project, add ff18_usb.asm, PF18_USB_REG.asm, and add the FF_USB_18F4550.lib file. Build appears to be successful: ends with build succeeded. I program the device and verify it, and it tells me the device is programmed successfully and verifies successfully. I plug the board into my Linux box (64 bit Ubuntu 11.04), and here's what I'm seeing in dmesg: [13843.230116] usb 6-3: new full speed USB device using ohci_hcd and address 17 [13843.370133] usb 6-3: device descriptor read/64, error -62 [13843.630123] usb 6-3: device descriptor read/64, error -62 [13843.890117] usb 6-3: new full speed USB device using ohci_hcd and address 18 [13844.040144] usb 6-3: device descriptor read/64, error -62 [13844.300133] usb 6-3: device descriptor read/64, error -62 [13844.560128] usb 6-3: new full speed USB device using ohci_hcd and address 19 [13844.980126] usb 6-3: device not accepting address 19, error -62 [13845.130133] usb 6-3: new full speed USB device using ohci_hcd and address 20 [13845.550143] usb 6-3: device not accepting address 20, error -62 [13845.550197] hub 6-0:1.0: unable to enumerate USB device on port 3 I'm assuming it's supposed to look like a USB serial device that I can connect minicom to port /dev/ttyUSB0 or the like. Any ideas on what I'm doing wrong? Cheers, Scott |
From: Mikael N. <mik...@pp...> - 2011-10-13 19:59:16
|
The first thing to try is to skip the IDLE_MODE in the config file. The IDLE_MODE causes the PIC to poll the USB tranceiver too seldom. Newer and faster PCs seems to have a problem with that ! Are xtal and pll setting correct ? Mike On 13.10.2011 20:46, Scott Balneaves wrote: > Hello! > > I'm trying to get flashforth going on a p18f4550. I've bought an experimenter > board from Olimex: > > http://www.olimex.com/dev/pic-usb-4550.html > > I've git-cloned the latest flashforth, and installed the MPLAB tools > that came with my PICKIT2 burner. > > I create a new project, add ff18_usb.asm, PF18_USB_REG.asm, and add the > FF_USB_18F4550.lib file. Build appears to be successful: ends with build > succeeded. I program the device and verify it, and it tells me the device > is programmed successfully and verifies successfully. > > I plug the board into my Linux box (64 bit Ubuntu 11.04), and here's what > I'm seeing in dmesg: > > [13843.230116] usb 6-3: new full speed USB device using ohci_hcd and address 17 > [13843.370133] usb 6-3: device descriptor read/64, error -62 > [13843.630123] usb 6-3: device descriptor read/64, error -62 > [13843.890117] usb 6-3: new full speed USB device using ohci_hcd and address 18 > [13844.040144] usb 6-3: device descriptor read/64, error -62 > [13844.300133] usb 6-3: device descriptor read/64, error -62 > [13844.560128] usb 6-3: new full speed USB device using ohci_hcd and address 19 > [13844.980126] usb 6-3: device not accepting address 19, error -62 > [13845.130133] usb 6-3: new full speed USB device using ohci_hcd and address 20 > [13845.550143] usb 6-3: device not accepting address 20, error -62 > [13845.550197] hub 6-0:1.0: unable to enumerate USB device on port 3 > > I'm assuming it's supposed to look like a USB serial device that I can > connect minicom to port /dev/ttyUSB0 or the like. > > Any ideas on what I'm doing wrong? > > Cheers, > Scott > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2d-oct > _______________________________________________ > Flashforth-devel mailing list > Fla...@li... > https://lists.sourceforge.net/lists/listinfo/flashforth-devel > |
From: Scott B. <sba...@al...> - 2011-10-14 00:10:01
|
On 11-10-12 02:38 PM, Mikael Nordman wrote: > The first thing to try is to skip the IDLE_MODE in the config file. > The IDLE_MODE causes the PIC to poll the USB tranceiver > too seldom. Gak! I realized now that my first response was to Mikael, and not to the list. My apologies. I've disabled IDLE_MODE in p18f-main.cfg. > Newer and faster PCs seems to have a problem with that ! > > Are xtal and pll setting correct ? I've set: constant clock=d'20000000' in p18f-main.cfg, recompiled, and re-flashed. Same thing's happening on the USB bus. Looking in p18f2455-2550-4455-4550.cfg, I'm seeing: config PLLDIV = 3 ; 12 MHz XT xtal config CPUDIV = OSC1_PLL2 ; 48 MHz cpu clock config USBDIV = 2 ; USB clock from 96 MHZ PLL divided by 2 I'd imagine these aren't correct, but I've no clue how they should be set. Mike, thanks for the help so far. This looks SO cool if I can get it running! Cheers, Scott > > Mike > > On 13.10.2011 20:46, Scott Balneaves wrote: >> Hello! >> >> I'm trying to get flashforth going on a p18f4550. I've bought an experimenter >> board from Olimex: >> >> http://www.olimex.com/dev/pic-usb-4550.html >> >> I've git-cloned the latest flashforth, and installed the MPLAB tools >> that came with my PICKIT2 burner. >> >> I create a new project, add ff18_usb.asm, PF18_USB_REG.asm, and add the >> FF_USB_18F4550.lib file. Build appears to be successful: ends with build >> succeeded. I program the device and verify it, and it tells me the device >> is programmed successfully and verifies successfully. >> >> I plug the board into my Linux box (64 bit Ubuntu 11.04), and here's what >> I'm seeing in dmesg: >> >> [13843.230116] usb 6-3: new full speed USB device using ohci_hcd and address 17 >> [13843.370133] usb 6-3: device descriptor read/64, error -62 >> [13843.630123] usb 6-3: device descriptor read/64, error -62 >> [13843.890117] usb 6-3: new full speed USB device using ohci_hcd and address 18 >> [13844.040144] usb 6-3: device descriptor read/64, error -62 >> [13844.300133] usb 6-3: device descriptor read/64, error -62 >> [13844.560128] usb 6-3: new full speed USB device using ohci_hcd and address 19 >> [13844.980126] usb 6-3: device not accepting address 19, error -62 >> [13845.130133] usb 6-3: new full speed USB device using ohci_hcd and address 20 >> [13845.550143] usb 6-3: device not accepting address 20, error -62 >> [13845.550197] hub 6-0:1.0: unable to enumerate USB device on port 3 >> >> I'm assuming it's supposed to look like a USB serial device that I can >> connect minicom to port /dev/ttyUSB0 or the like. >> >> Any ideas on what I'm doing wrong? >> >> Cheers, >> Scott >> >> ------------------------------------------------------------------------------ >> All the data continuously generated in your IT infrastructure contains a >> definitive record of customers, application performance, security >> threats, fraudulent activity and more. Splunk takes this data and makes >> sense of it. Business sense. IT sense. Common sense. >> http://p.sf.net/sfu/splunk-d2d-oct >> _______________________________________________ >> Flashforth-devel mailing list >> Fla...@li... >> https://lists.sourceforge.net/lists/listinfo/flashforth-devel >> > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2d-oct > _______________________________________________ > Flashforth-devel mailing list > Fla...@li... > https://lists.sourceforge.net/lists/listinfo/flashforth-devel -- Scott L. Balneaves | Eating words has never given me indigestion. Systems Department | -- Winston Churchill Legal Aid Manitoba | |
From: Pete Z. <pza...@pz...> - 2011-10-14 01:40:08
|
Scott, Here are some changes I have made for a 4550 USB board that has a 20 MHz XTAL. p18f-main.cfg disable IDLE_MODE and CPU_LOAD ;;;; PIC18F4550 constant clock = d'48000000' ; Hz p18f2455-2550-4455-4550.cfg config PLLDIV = 5 ; 20 MHz XT xtal Pete On 10/13/2011 8:09 PM, Scott Balneaves wrote: > On 11-10-12 02:38 PM, Mikael Nordman wrote: >> The first thing to try is to skip the IDLE_MODE in the config file. >> The IDLE_MODE causes the PIC to poll the USB tranceiver >> too seldom. > Gak! I realized now that my first response was to Mikael, and not to the > list. My apologies. > > I've disabled IDLE_MODE in p18f-main.cfg. > >> Newer and faster PCs seems to have a problem with that ! >> >> Are xtal and pll setting correct ? > I've set: > > constant clock=d'20000000' > > in p18f-main.cfg, recompiled, and re-flashed. Same thing's happening on the > USB bus. > > Looking in p18f2455-2550-4455-4550.cfg, I'm seeing: > > config PLLDIV = 3 ; 12 MHz XT xtal > config CPUDIV = OSC1_PLL2 ; 48 MHz cpu clock > config USBDIV = 2 ; USB clock from 96 MHZ PLL divided by 2 > > I'd imagine these aren't correct, but I've no clue how they should be set. > > Mike, thanks for the help so far. This looks SO cool if I can get it running! > > Cheers, > Scott > |
From: Scott B. <sba...@al...> - 2011-10-14 02:29:18
|
On 11-10-13 08:24 PM, Pete Zawasky wrote: > Scott, > > Here are some changes I have made for a 4550 USB board that has a 20 > MHz XTAL. > p18f-main.cfg > disable IDLE_MODE and CPU_LOAD > ;;;; PIC18F4550 > constant clock = d'48000000' ; Hz > > > p18f2455-2550-4455-4550.cfg > config PLLDIV = 5 ; 20 MHz XT xtal > > > Pete OK, let's try! <recompile, reprogram, plug in> Oooo! Looks good! Output from dmesg: [ 165.030295] usb 5-1: new full speed USB device using ohci_hcd and address 5 [ 165.249659] cdc_acm 5-1:1.0: This device cannot do calls on its own. It is not a modem. [ 165.249703] cdc_acm 5-1:1.0: ttyACM0: USB ACM device [ 165.253145] usbcore: registered new interface driver cdc_acm [ 165.253152] cdc_acm: v0.26:USB Abstract Control Model driver for USB modems and ISDN adapters lsusb: Bus 005 Device 005: ID faf0:faf0 That's what we're looking for. ls -la /dev/ttyACM0 crw-rw---- 1 root dialout 166, 0 2011-10-13 21:18 /dev/ttyACM0 OK, proof's in the pudding: Welcome to minicom 2.5 OPTIONS: I18n Compiled on Feb 5 2011, 06:31:42. Port /dev/ttyACM0 Press CTRL-A Z for help on special keys ok<$,ram> 1 2 + . 3 ok<$,ram> WOW! $5 chip running a high level language. Now THIS is cool! Thanks to Mikael for FF, and to you, Pete, for the magic! I'm new to the PIC world, so how does one calculate the PLL, etc, values? Cheers, Scott > > > > > On 10/13/2011 8:09 PM, Scott Balneaves wrote: >> On 11-10-12 02:38 PM, Mikael Nordman wrote: >>> The first thing to try is to skip the IDLE_MODE in the config file. >>> The IDLE_MODE causes the PIC to poll the USB tranceiver >>> too seldom. >> Gak! I realized now that my first response was to Mikael, and not to the >> list. My apologies. >> >> I've disabled IDLE_MODE in p18f-main.cfg. >> >>> Newer and faster PCs seems to have a problem with that ! >>> >>> Are xtal and pll setting correct ? >> I've set: >> >> constant clock=d'20000000' >> >> in p18f-main.cfg, recompiled, and re-flashed. Same thing's happening on the >> USB bus. >> >> Looking in p18f2455-2550-4455-4550.cfg, I'm seeing: >> >> config PLLDIV = 3 ; 12 MHz XT xtal >> config CPUDIV = OSC1_PLL2 ; 48 MHz cpu clock >> config USBDIV = 2 ; USB clock from 96 MHZ PLL divided by 2 >> >> I'd imagine these aren't correct, but I've no clue how they should be set. >> >> Mike, thanks for the help so far. This looks SO cool if I can get it running! >> >> Cheers, >> Scott >> > > > ------------------------------------------------------------------------------ > All the data continuously generated in your IT infrastructure contains a > definitive record of customers, application performance, security > threats, fraudulent activity and more. Splunk takes this data and makes > sense of it. Business sense. IT sense. Common sense. > http://p.sf.net/sfu/splunk-d2d-oct > _______________________________________________ > Flashforth-devel mailing list > Fla...@li... > https://lists.sourceforge.net/lists/listinfo/flashforth-devel |
From: Pete Z. <pza...@pz...> - 2011-10-14 14:00:50
|
Hi Scott, That is great news...Good luck with FF on the 4550. I use the PICDEM FSUSB Demo board here for the USB testing. I generally go to the PIC Data Sheet for the particular processor and study the Oscillator Configuration section carefully. One way or another, you will need 20MHz for the USB. Other internal frequencies will be your decision. As another example, for the 18F6527 FF3.8 with UART at 38.4K baud, I change the following: ff18_usb.asm FROM: #ifdef OSCCON movlw 0x70 ; Use full internal OSC frequency movwf OSCCON, A #endif TO: ; ppz osc ; ------------------------------------------------------------ #ifdef __18F6527 ; Internal Oscillator movf OSCCON, W, A iorlw b'01110000' ; 8MHz movwf OSCCON, A nop ; Enable Oscillator PLL movf OSCTUNE, W, A iorlw b'01000000' ; Enable PLL for 4x8MHz movwf OSCTUNE, A nop nop #else #ifdef OSCCON movlw 0x70 ; Use full internal OSC frequency movwf OSCCON, A #endif #endif ; ------------------------------------------------------------ p18f-main.cfg ;;;; PIC18F6527 Internal Oscillator with PLL constant clock = d'32000000' p18fxxxx.cfg ifdef __18F6527 #include p18f6527.inc ;;; #include p18f6722-family.cfg #include p18f6527.cfg #define PICTYPE "PIC18F6527 " #define FLASH_HI 0xbfff #define EEPROM_HI 0xefff #define RAM_HI 0xff60 endif And add the following file: ;********************************************************************** ; * ; Filename: p18f6527.cfg * ; Date: 4:23 PM 10/4/2011 * ; FF Version: 3.8 * ; Copyright: Pete Zawasky * ; Author: Pete Zawasky * ; * ;********************************************************************** ; Based on p18f6722-family.cfg by Mikael Nordman * ;********************************************************************** ; FlashForth is licensed acording to the GNU General Public License* ;********************************************************************** ;;; FlashForth processor specific configuration ; The config directive is used control the processor configuration bits ; See processor specific include file for details. #if CONFIG_RESET == 0x0000 config OSC = INTIO67 config FCMEN = OFF config IESO = OFF config PWRT = OFF config BOREN = SBORDIS config BORV = 3 config WDT = OFF config WDTPS = 32768 config MCLRE = ON config LPT1OSC = ON config CCP2MX = PORTC config STVREN = ON config LVP = OFF config BBSIZ = BB8K config XINST = OFF config DEBUG = OFF config CP0 = OFF config CP1 = OFF config CP2 = OFF config CPB = OFF config CPD = OFF config WRT0 = OFF config WRT1 = OFF config WRT2 = OFF config WRTB = ON config WRTC = ON config WRTD = OFF config EBTR0 = OFF config EBTR1 = OFF config EBTR2 = OFF config EBTRB = OFF #endif ;;; Some constants controlling how writes to program flash is made. constant flash_write_outer_loop = d'1' constant flash_write_inner_loop = d'64' ;********************************************************************** As you can see, one has to really focus on the particular processor for the OSC, PLL, and CONFIGURATION bits. Then I really pound away on Mikael's FF code to see if it really works like he says it should.... A software test suite (validation suite) for FF like we had in eFORTH would really be great. In the mean time, try all the different applications you can with lots of different words and learn FF. Pete |
From: Mikael N. <mik...@pp...> - 2011-10-14 16:02:10
|
Hi Scott. Great that it works ! So if you want you can make the CPU run slower with the CPUDIV. PLLDIV must be set according to what kind of XTAL you have. USBDIV should always be 2 The clock constant tells how fast the CPU is running. It is needed for setting up the 1 ms timer and for configuring the UART baud rate. Did you have any special project in mid for FlashForth. For the 4550 and cousins, here are a few examples for full speed USB. config PLLDIV = 1 ; 4 MHz XT xtal config PLLDIV = 2 ; 8 MHz XT xtal config PLLDIV = 3 ; 12 MHz XT xtal config PLLDIV = 4 ; 16 MHz XT xtal config PLLDIV = 5 ; 20 MHz XT xtal config CPUDIV = OSC1_PLL2 ; 48 MHz cpu clock constant clock=d'48000000' config CPUDIV = OSC2_PLL3 ; 24 MHz cpu clock constant clock=d'24000000' config CPUDIV = OSC3_PLL4 ; 16 MHz cpu clock constant clock=d'16000000' config CPUDIV = OSC4_PLL6 ; 8 MHz cpu clock constant clock=d'8000000' config USBDIV = 2 ; USB clock from 96 MHZ PLL divided by 2 Cheers Mike |